sounding system bell in a shell script run from toolbar icon

2002-06-25 Thread Shawn Lamson
hey all -

here's my question:

I use IceWm which i love.  You can write shell scripts and initiate
them via icons on the menu or toolbar... i wrote one to mount and
unmount my CD-Rom.  Part of this script is to echo a system bell when
the Drive is fully mounted/unmounted or a longer bell if the device is
busy etc...  It works great when executed from a terminal window or
xterm in X.  But when i execute it via the menu/toolbar icon it won't
sound the system bell ( i assume it has something to do with echo ) ...
so far the way i have found around this is to tell the icon to open an
xterm window 

#cut from $HOME/.icewm/menu
#the first word prog means program ; CD is the title displayed ;
#mounter is the name internal to Icewm and the rest is what is executed

prog CD mounter xterm +ls -geom 5x3-0+0 -T '' -bg red -fg red -e
/home/slamson/bin/mounter

#prog CD mounter mounter

#end of cut

the uncommented one opens the xterm and it functions fine - opening a
small xterm and echoing a bell... the commented one works great too,
but no system bell.

How can i get the system bell to sound - you'll note i also use xset b
to set duration etc at the bottom of the script - without opening a
window to run this simple script?


TIA - Shawn   (script mounter follows)



#!/bin/sh
#shell program to mount / unmount cdrom drive
#shawn lamson 06/24/2002

set -x  #uncomment for testing

DEVICE=/dev/scd0
MOUNT_PT=/cdrom
STATUS=ON
ERROR=' ERROR: mount or remount manually'

#
#   this program could grep the fields of /etc/fstab to find
devices but doesnt
#   it assumes /cdrom as mount point and my current device
/dev/scd0
#

if  ! grep $MOUNT_PT /etc/fstab
then
echo -e Device $DEVICE is not set to mount in /etc/fstab\a
echo $ERROR
exit 1
fi

if  grep $DEVICE /etc/mtab
then
STATUS=ON
else
STATUS=OFF
fi

if [ $STATUS = ON ]
then
umount $DEVICE  cdcd open  echo -e \a  exit 0
#
#   this will fail if device is busy
#   should drop down to echo bell
#

elif [ $STATUS = OFF ]
then
cdcd close
mount /cdrom
echo -e \a#indicate CD is ready
exit 0
else
echo $ERROR
echo You may want to examine the output of #cat /etc/fstab
echo and #cat /etc/mtabfor clues
exit 1
fi
#
#this bell will execute if all else fails - for example device $DEVICE
is busy
#
echo is device:$DEVICE busy?
xset b 100 700 1000 #set bell vol pitch duration
echo -e \a
xset b  #sets bell back to defaults
set +x  #uncomment for testing



=
Shawn Lamson
Debian/GNU Linux Woody
Kernel 2.2.19pre17
XFree86 Version 4.1.0.1 / X Window System
Jesus Loves You!

__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: sounding system bell in a shell script run from toolbar icon

2002-06-25 Thread Shawn Lamson

--- Shawn Lamson [EMAIL PROTECTED] wrote:
 hey all -
 
 here's my question:
 
---snip
 busy etc...  It works great when executed from a terminal window or
 xterm in X.  But when i execute it via the menu/toolbar icon it won't
 sound the system bell ( i assume it has something to do with echo )
 ...
 so far the way i have found around this is to tell the icon to open
 an
 xterm window 
---snip 
now i am echoing a CTRL-G to a /tmp/sound$$ file and then catting it -
it works!  But let me know if there is a better way that you know of.

PS.  Yes - i also found utilities like eject eject -t and cdchk
to help out!
Thanks

  
 #cut from $HOME/.icewm/menu
 #the first word prog means program ; CD is the title displayed ;
 #mounter is the name internal to Icewm and the rest is what is
 executed
 
 prog CD mounter xterm +ls -geom 5x3-0+0 -T '' -bg red -fg red -e
 /home/slamson/bin/mounter
 
 #prog CD mounter mounter
 
 #end of cut
 
 the uncommented one opens the xterm and it functions fine - opening a
 small xterm and echoing a bell... the commented one works great
 too,
 but no system bell.
 
 How can i get the system bell to sound - you'll note i also use xset
 b
 to set duration etc at the bottom of the script - without opening a
 window to run this simple script?
 
 
 TIA - Shawn   (script mounter follows)
 
 
 
 #!/bin/sh
 #shell program to mount / unmount cdrom drive
 #shawn lamson 06/24/2002
 
 set -x  #uncomment for testing
 
 DEVICE=/dev/scd0
 MOUNT_PT=/cdrom
 STATUS=ON
 ERROR=' ERROR: mount or remount manually'
 
 #
 #   this program could grep the fields of /etc/fstab to find
 devices but doesnt
 #   it assumes /cdrom as mount point and my current device
 /dev/scd0
 #
 
 if  ! grep $MOUNT_PT /etc/fstab
 then
 echo -e Device $DEVICE is not set to mount in /etc/fstab\a
 echo $ERROR
 exit 1
 fi
 
 if  grep $DEVICE /etc/mtab
 then
 STATUS=ON
 else
 STATUS=OFF
 fi
 
 if [ $STATUS = ON ]
 then
 umount $DEVICE  cdcd open  echo -e \a  exit 0
 #
 #   this will fail if device is busy
 #   should drop down to echo bell
 #
 
 elif [ $STATUS = OFF ]
 then
 cdcd close
 mount /cdrom
 echo -e \a#indicate CD is ready
 exit 0
 else
 echo $ERROR
 echo You may want to examine the output of #cat /etc/fstab
 echo and #cat /etc/mtabfor clues
 exit 1
 fi
 #
 #this bell will execute if all else fails - for example device
 $DEVICE
 is busy
 #
 echo is device:$DEVICE busy?
 xset b 100 700 1000 #set bell vol pitch duration
 echo -e \a
 xset b  #sets bell back to defaults
 set +x  #uncomment for testing


=
Shawn Lamson
Debian/GNU Linux Woody
Kernel 2.2.19pre17
XFree86 Version 4.1.0.1 / X Window System
Jesus Loves You!

__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: sounding system bell in a shell script run from toolbar icon

2002-06-25 Thread James Hook
G'Day,

On Tue, 25 Jun 2002, Shawn Lamson wrote:
  here's my question:
  xterm in X.  But when i execute it via the menu/toolbar icon it won't
  sound the system bell ( i assume it has something to do with echo )
 now i am echoing a CTRL-G to a /tmp/sound$$ file and then catting it -
 it works!  But let me know if there is a better way that you know of.

Have a look for the command beep, it allows you to make all sorts of beeps
using the command line.

If thats not an option it may be possible to echo ^G to /dev/console which
I have found makes a beep everytime, no matter how it is running. One
thing I have found however with sending ^G's is that there needs to be a
delay if you want more than 1 beep otherwise it just buffers the beep into
1.. if your after more then give the beep command a try.

Cheereo,
-- 
  \\\
8(o o)8
-ooO--(_)--Ooo-
 .-`~`-. | James Hook
 H O O K | [EMAIL PROTECTED]
 ~-._.-~ | http://hooksoft.8m.com
-ooO---Ooo-
... Carpe Aptenodytes! (Seize the Penguins!)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]