need help on shell script

2004-06-17 Thread klr
Hi list,

I read http://www.linuxgazette.com/node/view/9074 and tried to adopt this
script to my ipfw firewall:

#!/bin/sh
tail -f /var/log/security | \
  awk '
$0 ~ /ICMP/ {
system(cat /root/sounds/icmp.wav  /dev/dsp );
}
$0 ~ /TCP/ {
system(cat /root/sounds/tcp.wav  /dev/dsp );
}
$0 ~ /UDP/ {
system(cat /root/sounds/udp.wav  /dev/dsp );
}
   '

This is what I got. However, sounds won't play one after another. e.g, if
3 packets are blocked at the same time, 2 TCP and one UDP, the system will
always wait for a sound to finish before playing the next. I want it to be
able to play the sounds in sequence (as fast as possible), but I couldn't
figure a way out!

Any shell script guru could give an helping hand? ;)

Regards

-- 
www.6s-gaming.com

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: need help on shell script

2004-06-17 Thread Adam Smith
On Thu, Jun 17, 2004 at 08:15:23PM -, [EMAIL PROTECTED] said:
 Hi list,
 
 I read http://www.linuxgazette.com/node/view/9074 and tried to adopt this
 script to my ipfw firewall:
 
 #!/bin/sh
 tail -f /var/log/security | \
   awk '
 $0 ~ /ICMP/ {
 system(cat /root/sounds/icmp.wav  /dev/dsp );
 }
 $0 ~ /TCP/ {
 system(cat /root/sounds/tcp.wav  /dev/dsp );
 }
 $0 ~ /UDP/ {
 system(cat /root/sounds/udp.wav  /dev/dsp );
 }
'
 
 This is what I got. However, sounds won't play one after another. e.g, if
 3 packets are blocked at the same time, 2 TCP and one UDP, the system will
 always wait for a sound to finish before playing the next. I want it to be
 able to play the sounds in sequence (as fast as possible), but I couldn't
 figure a way out!

This is the behaviour of the device, not your script.  Only one process can
access the device at any one time, and so your subsequent sounds must wait
for the first one to finish before it will be able to use /dev/dsp.

When using /dev/dsp, programs like artsd (which comes with KDE) allow other
artsd-aware programs to send sound events through the artsd daemon, and
artsd controls all the mixing of sounds together to send them out through
/dev/dsp.

So, you need something like this to play your events, rather than catting
them to /dev/dsp.  Unfortunately I don't know of any console programs that
do this.  Try looking in /usr/ports/audio :)


-- 
Adam Smith
Internode   : http://www.internode.on.net
Phone   : (08) 8228 2999

Dog for sale:  Eats lots and is fond of children.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]