LJ Archive

Listing 2. Cron Program

#/bin/sh
#
# Monitor Log Re-Set
# This file runs once a day from cron. It rotates
# the webmonitor_log file and restarts the
# colortail display.

# Our PPP connection sets the name of the
# connected computer to "C128.someisp.com"
# so this is what we grep the "w" command for.

pty=`w | grep C128 | cut -c 10-15`

# Kill colortail, rotate the log file and
# restart Apache and the System Log D

/usr/bin/killall colortail;
cp /var/log/httpd/webmonitor_log /var/log/httpd/

rm /var/log/httpd/webmonitor_log;
kill -1 `cat /var/run/httpd.pid`;
/usr/bin/killall -HUP syslogd;

# If our C128 is connected, this sends
# the output of colortail to it:

if [ "$pty" != "" ]
then
colortail -f -k /etc/colortail.conf

fi
LJ Archive