[comp.unix.xenix] HDB-like tools

bill@ssbn.WLK.COM (Bill Kennedy) (05/11/88)

A couple of weeks or so ago I said I would post the little collection
of HoneyDanBer-like tools I fixed up to use with SCO Vr2.2.3.  Here
are the first two.  They are taken right out of the system that runs
them so you will have to season to taste.  Here's a shar for them -
================= cut ========================= cut ======================
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	uudemon.sched
#	poll.ssbn
# This archive created: Tue May 10 15:45:25 1988
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'uudemon.sched'" '(379 characters)'
if test -f 'uudemon.sched'
then
	echo shar: "will not over-write existing file 'uudemon.sched'"
else
sed 's/^	X//' << \SHAR_EOF > 'uudemon.sched'
	X#
	X#   uudemon.sched
	X#
	X#   This script checks the uucp spool for work to be done
	X#   for uucp.  If there is any it will place a call,
	X#   otherwise it exits without ceremony
	X#
	XSPOOL=/usr/spool/uucp
	Xfor site in killer rrm ssbn
	Xdo
	X	if ls $SPOOL | grep "C.$site"
	X	then
	X		if test -s $SPOOL/STST.$site
	X		then
	X			rm -f $SPOOL.STST.$site
	X		fi
	X		/usr/lib/uucp/uucico -r1 -s$site
	X	fi
	Xdone
SHAR_EOF
if test 379 -ne "`wc -c < 'uudemon.sched'`"
then
	echo shar: "error transmitting 'uudemon.sched'" '(should have been 379 characters)'
fi
chmod +x 'uudemon.sched'
fi
echo shar: "extracting 'poll.ssbn'" '(604 characters)'
if test -f 'poll.ssbn'
then
	echo shar: "will not over-write existing file 'poll.ssbn'"
else
sed 's/^	X//' << \SHAR_EOF > 'poll.ssbn'
	X#
	X#   /usr/lib/uucp/poll.ssbn
	X#
	X#   If there has not been any communication with
	X#   this site, make a phoney C. file so that a
	X#   call will be placed by the scheduler daemon
	X#
	XSITE=ssbn
	XSPOOL=/usr/spool/uucp
	XLOG=$SPOOL/LOGFILE
	X#
	X#   Check the log to see if we have talked to that site
	X#   since the log was last cleaned out.
	X#
	Xif cat $LOG | grep $SITE
	Xthen
	X#   They are in the log, just exit successfully
	X	exit 0
	Xelse
	X#
	X#   They are not in the log file, force a dummy C file
	X#
	X	j=`expr $SITE : '\(.\{1,7\}\)'`
	X	touch $SPOOL/C.${j}n0000
	X	chgrp group $SPOOL/C.${j}n0000
	X	chown uucp $SPOOL/C.${j}n0000
	Xfi
SHAR_EOF
if test 604 -ne "`wc -c < 'poll.ssbn'`"
then
	echo shar: "error transmitting 'poll.ssbn'" '(should have been 604 characters)'
fi
chmod +x 'poll.ssbn'
fi
exit 0
#	End of shell archive
======================= cut ======================== cut ======================
Note that the first is run from time to time from cron.  If there is work
for a site (the system I took it out of only has three neighbors), it will
remove the STST file and place the call.  I suppose it would have been as
easy to cycle through L.sys, but I never claimed these were elegant, now you
will believe me :-)

The second makes sure that a site is contacted at least once a day (I clear
out the logs at midnight).  If the site has been called or called us they
appear in the log file, so it just exits.  Otherwise it fabricates a dummy
C file for the site which will stimulate a call when the scheduler runs the
next time.  I will toss out some more in the coming couple of weeks.
-- 
Bill Kennedy  usenet      {rutgers,ihnp4!killer,cbosgd}!ssbn!bill
              internet    bill@ssbn.WLK.COM