[news.sysadmin] here's automatic control of /usr/spool file space

dave@lsuc.uucp (David Sherman) (02/17/89)

We run this from crontab every half hour:

# /usr/lib/uucp/spoolfull -- written by msb@sq and dave@lsuc
PATH=/bin:/usr/bin:/usr/ucb
set `df /dev/spool | tail -1`
spoolcnt=$5
if test $spoolcnt -lt 1000
then
	(cd /usr/lib/uucp; mv uucico uucico-stopped)
	if test $spoolcnt -lt 100
	then
		>/usr/spool/emerg-reserve
	fi
	df /dev/spool | mail -s "/usr/lib/uucp/uucico set aside, running expire now" dave keith
	if test -r /usr/spool/uucp/LCK..attcan
	then
		set `od -d /usr/spool/uucp/LCK..attcan`
		kill -15 $3
		echo "attcan uucico was killed" | mail -s "attcan uucico killed" dave keith
	fi
	su news expire /usr/lib/news/explist
	exit 0
fi
if test -r /usr/lib/uucp/uucico-stopped
then
	if test $spoolcnt -gt 1500
	then
		(cd /usr/lib/uucp; mv uucico-stopped uucico)
		df /dev/spool | mail -s "uucico restarted" dave keith
	fi
	exit 0
fi
exit 1

-------------------------------------------------------------
Some comments:
1. We run C news expiry (as well as the rest of C news), so
   expire can be run during the day without loading the system.
   It's also tailored to expire large useless groups very quickly
   (1-2 days, as soon as they're batched).
2. attcan is our incoming feed.  If uucico is mv'ed away, the existing
   call can still overrun us, so we blow it away.
3. Our DOWNSTREAM news feeds have /usr/bin/uucico, which is a link
   to /usr/lib/uucp/uucico, as their /etc/passwd shell and in the
   script wherewith we do our regular polling.  So they'll still
   connect, and, it is hoped, drain away some stuff.
4. We run all UUCP lines at 1200 baud.  If you have Telebits, your
   timing control may be different (e.g., 1Mb isn't enough free space
   for 1/2 hour).
5. /usr/spool/emerg-reserve is 100K or so of junk, just for emergencies.

With recent high news volumes, spoolfull has been cutting in to
save us a lot recently.  Does away with a LOT of headaches.
UUCP simply gets disabled until the space is freed up, then
automatically reenabled.  Hope this helps some of you.

David Sherman
The Law Society of Upper Canada
-- 
Moderator, mail.yiddish
{ uunet!attcan  att  utzoo }!lsuc!dave          dave%lsuc@ai.toronto.edu