| may92.tar |
Listing 2
# # onitego.sh: Version 2.0 2/27/92 by Leor Zolman # # Run scheduled overnite jobs (queued up in jobs subdirectories) # # usage: # onitego.sh >>/usr/spool/onite/onite.log 2>&1 # (place in root's cron table, schedule for once/twice nightly) # PATH=/bin:/usr/bin:/usr/local:/etc # Check all the usual places debug=N NPRIORITIES=7 NTOLEAVE=50 # number of files to leave in jobsdone/stdout if [ $debug = Y ]; then SPOOLDIR=. else SPOOLDIR=/usr/spool/onite fi LOCKFILE=$SPOOLDIR/Onite.LOCK DBPATH=.:/u4/data; export DBPATH INFORMIDIR=/usr/informix; export INFORMIXDIR PATH=.:/bin:/usr/bin:/usr/local:/etc:$INFORMIXDIR/bin; export PATH cd $SPOOLDIR if [ -r $LOCKFILE ] then exit 0 # if still running previous batch, quit fi FoundAnyYet=N # no jobs encountered yet priority=1 while [ $priority -le $NPRIORITIES ] do if [ `/usr/local/checknum \`ls jobs/P$priority | wc\`` -ne 0 ] then if [ $FoundAnyYet = N ]; then echo "`date \"+%D (%r)\"`: Beginning run." trap "rm $LOCKFILE; exit 1" 1 2 3 9 14 15 touch $LOCKFILE # create lock file FoundAnyYet=Y fi for jobfile in jobs/P$priority/* do echo " `date \"+%r\"`: Processing $jobfile" name=`basename $jobfile` sh <$jobfile >stdout/$name 2>&1 mv $jobfile jobsdone done fi priority=`expr $priority + 1` done if [ $FoundAnyYet = Y ]; then fleave.sh jobsdone $NTOLEAVE # delete all but newest 50 job files fleave.sh stdout $NTOLEAVE # delete all but newest 50 std output files rm $LOCKFILE echo " `date \"+%r\"`: Done." echo else echo "`date \"+%D (%r)\"`: No jobs spooled; no action taken." echo fi
|