Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!umix!b-tech!zeeff
From: zeeff@b-tech.UUCP (Jon Zeeff)
Newsgroups: comp.unix.questions
Subject: Re: UUCICO exit status...
Message-ID: <4002@b-tech.UUCP>
Date: Thu, 26-Nov-87 19:13:46 EST
Article-I.D.: b-tech.4002
Posted: Thu Nov 26 19:13:46 1987
Date-Received: Sun, 29-Nov-87 18:49:39 EST
References: <134@csd_v.UUCP>
Reply-To: zeeff@b-tech.UUCP (Jon Zeeff)
Organization: Branch Technology Ann Arbor, MI
Lines: 59
Keywords: uucp, uucico

In article <134@csd_v.UUCP> bak@csd_v.UUCP (Bruce) writes:
>Perhaps I am reinventing the wheel here, but I am trying to write
>a utility that polls a system and continues to retry every so often
>( default 1 hour intervals ) until a successful connection is established.
>

I found that the most reliable way to tell if a connection has taken place
is uusub (SysV.2 w/o HDB).  So you get something like:


# Execute this script just after midnight with "poll time sites1 site2 .."
# -- Jon Zeeff  (umix!b-tech!zeeff)

. /etc/TIMEZONE

quit=$1
shift

today=`date +%d`

# loop until the quit time
while test `date +%H` -le $quit
do
   
   for j in $*
   do
      # trim to 6 chars
      i=`expr "$j" : '\(.\{1,6\}\).*'`
   
      laston=`uustat -M$j`
      laston=`expr "$laston" : '.*/\([0-9].\).*' 2> /dev/null`
   
      if test $laston -ne $today 2> /dev/null
         then

         /usr/lib/uucp/uucico -r1 -s$j
         status=$?

	 # Code to handle the case where the uukill daemon noticed that
	 # disk space was running out and killed incoming uucp connections
	 # if it was killed, then disk is full and we shouldn't call for awhile
         if test status -eq 15 
         then
            sleep 5000
         fi
   
         # wait in case uuxqt is going to trigger something
         sleep 40
      fi
   done

   # Wait a while before trying again
   sleep 1000
done


-- 
Jon Zeeff           		Branch Technology,
uunet!umix!b-tech!zeeff  	zeeff%b-tech.uucp@umix.cc.umich.edu