[news.admin] "whack" script question

root@libove.UUCP (The Super User) (06/10/88)

I have a script that someone posted to the net some time back to help
in repeatedly calling a uucp neighbor until the conversation completes
successfully. I just realized that this script has something I do not
understand; specifically, what tells it to call if the last transaction
*was* successful, but more than a given amount of time has passed...
My reading of the script says that nothing does, and that until my
machine has more outgoing stuff, that script will not call my neighbor.

Any thoughts, modifications, etc... welcomed! Here is the script:

:
# Script to whack on DARTH.  If uucico is not running to DARTH, and if the
# last conversation was not successful, a call is forced.

# Call this script once for each try calling DARTH.

# Written 13 November 1987 by Stanley F. Quayle
# Modified 29 November 1987 by Jay M. Libove (libove!libove) to
#  work for "libove" calling "darth"
# modified 1 May 1988 by Jay M. Libove (libove!libove) for the case
#  that the logfile is empty, so nothing gets returned by the uulog
#  command call.

PATH=:/bin:/usr/bin:/usr/lib/uucp
cd /usr/lib/uucp

# If a lock file exists, exit
test -r /usr/spool/uucp/LCK..darth && exit 0

# Exit if the last "OK (conversation complete)" is more recent than the
# last "FAIL" uulog entry
lastgood=`uulog -sdarth | grep -n "OK (conversation complete)" | tail -1 | sed -e "s/:.*//"`
lastbad=`uulog -sdarth | grep -n "FAIL" | tail -1 | sed -e "s/:.*//"`

if [ "$lastgood" -ne "" ]
 then if [ $lastgood -gt $lastbad ]
  then exit 0
 fi
fi

# Delete the status file
rm -f /usr/spool/uucp/STST.darth

# Create a work file
touch /usr/spool/uucp/C.darthnPOLL

# Call the system
uucico -r1 -sdarth


-- 
Jay Libove (Jay.Libove@andrew.cmu.edu  or  pitt!darth!libove!libove)