home *** CD-ROM | disk | FTP | other *** search
- From: sahayman@iuvax.cs.indiana.edu (Steve Hayman)
- Newsgroups: alt.sources
- Subject: audioping: a useful hack for network debugging
- Message-ID: <1991Feb19.210706.24496@news.cs.indiana.edu>
- Date: 19 Feb 91 21:06:58 GMT
-
- Here is a quick hack I dreamed up one night when we were
- having network problems on the thinwire in our office.
-
- This simple script will "ping" another host, and make an appropriate sound
- whenever a returned packet is received (which is once a second, if
- everything is working). So you can go wandering around your network
- trying to locate problems, and if you fiddle the right connector and
- things suddenly start working again, you'll know about it because
- you'll hear this voice in the background going PING ... PING ... PING
- (or making whatever other sound you want.)
-
-
- Before you run this, you need to find an appropriate sound source,
- and change one line in the script to indicate how you want
- the sound produced. (The default is just to echo a beep,
- which works and is portable, but isn't very exciting.)
-
- If you're on a NeXT, you can do this:
-
- % sndrecord ping.snd
- hit RETURN
- say "PING" into the microphone
- hit RETURN again - quickly, you want the sound file
- to be less than one second long.
-
- edit the script to add this line
-
- makenoise="sndplay ping.snd"
-
-
- [NeXT users may prefer to get the NeXTStep program "Ping.app",
- written by Chris Kane (kane@nic.gac.edu) which is based on
- this idea, only with a graphical interface. You can
- ftp it from nic.gac.edu, it's pub/next/apps/Ping2.0.tar.Z]
-
-
- If you're on a Sparcstation, and you have a microphone attached
-
- % cat /dev/audio >ping.snd
- say "PING" into the microphone
- *QUICKLY* hit control-C (or your interrupt character) to make
- sure the sound file is less than 1 second long.
-
- edit the script to add this line
-
- makenoise="cat ping.snd >/dev/audio"
-
-
- Of course you may be able to find (or prepare) a better sound file, such as
- a nice submarine "PINGGGGG" sound effect, somewhere else. Just substitute
- the appropriate definition of "makenoise" into this script.
-
- Here's the script. Don't forget to change the definition of "makenoise"
- if you want something other than a control-G beep.
-
-
- #!/bin/sh
- # audioping host
- # Ping a host, make a noise for each packet received.
- # Useful for network debugging.
- # Works on Sparcstations and Nexts.
- #
- # Be sure to uncomment the appropriate 'makenoise' line, depending
- # on whether you want a simple ^G beep or a more complex sound.
- #
- # Steve Hayman
- # Indiana University
- # sahayman@cs.indiana.edu
- # Tue Feb 19 16:06:00 EST 1991
-
- PATH=/etc:/usr/etc:/bin:/usr/bin:/usr/ucb export PATH
-
- case "$#" in
- 1) ;;
- *) echo "$0: Use: $0 hostname" 1>&2; exit 1 ;;
- esac
-
- # Set the 'makenoise' variable to some sort of program
- # that makes a noise. This can be whatever you want,
- # but if the noise is more than 1 second long you'll have problems
- # with timing getting out of sync.
-
-
- # On a plain ordinary terminal, make a noise by echoing a control-G.
- # (We do it this way so that we don't have to put a literal ^G in this file.)
- makenoise='echo -n . | tr . \\07'
-
- # On a Sun, if you have an appropriate sound file, you can make
- # a noise this way:
- # makenoise="cat /some/sound/file >/dev/audio"
-
-
- # On a NeXT you can play a sound file this way.
- # Try running "snrdrecord some-file.snd", hit RETURN,
- # say "PING" into the microphone, hit RETURN again.
- #
- # makenoise="sndplay some-file.snd"
-
- ping -r -s $1 | tee /dev/tty | while read line; do
- case "$line" in
- *icmp*) eval $makenoise ;;
- esac
-
- done
-