Listing 3: prun--The wrapper script
#!/bin/sh
#
# Listing #3
#
# Run the probe from a shell wrapper so we can try
# to kill it if it gets hung. This is for Solaris 2.3,
# using the System V version of the ps command.
#
$HOME/Cron/probe -m &
sleep 7200
#
# Kill the probe if it is still running.
kill -9 $! >/dev/null 2>&1
#
# Kill any children still hanging around.
PID=`ps -fu313|grep probe|grep -v grep
| sed -e 's/^[^0-9]*\([0-9]*\).*$/\1/'`
if [ "$PID" ] ; then
kill -9 $PID >/dev/null 2>&1
fi
#
sleep 30
#
# Try to kill hung connections to other machines.
PID=`ps -fu313|grep /usr/ucb/rsh
| grep -v grep|sed -e 's/^[^0-9]*\([0-9]*\).*$/\1/'`
if [ "$PID" ] ; then
kill -9 $PID >/dev/null 2>&1
fi
# End of prun.
|