Listing 1: The logit script
#!/bin/sh
#
# Move today's system log files to yesterday's,
# and yesterday's to the day before's, etc.
# Then, mail the contents of yesterday's.
for LOGFILE in /usr/adm/isdn.log /usr/adm/syslog
do
OLD=6 # Logs older than current.
while [ $OLD -gt 1 ]
do
NEW=`expr $OLD - 1`
mv $LOGFILE.$NEW $LOGFILE.$OLD
OLD=$NEW
done
mv $LOGFILE $LOGFILE.$OLD 2> /dev/null
touch $LOGFILE 2> /dev/null
done
kill -HUP `cat /etc/syslog.pid` # Restart syslog.d
nohup /usr/bin/mailx -s "SYSLOG Status" root \
</usr/adm/syslog.1 &
nohup grep "Security Error" /usr/adm/isdn.log.1 \
| /usr/bin/mailx -s "ISDN Status" root &
|