#! /bin/csh
# Shell script to cull unusual messages from news log file
# and clean up old log files automatically in similar manner to
# /usr/adm/newlog
cd /usr/lib/news
# Send error messages and summary to administrator
( cat errlog ; awk -f cleanup.awk log ) | mail -s "News Summary" usenet
cp /dev/null errlog
# Copy logfile
foreach LOG (log log.unbatch)
    cd /usr/lib/news/OLDLOGS
    rm $LOG.7
    mv $LOG.6  $LOG.7
    mv $LOG.5  $LOG.6
    mv $LOG.4  $LOG.5
    mv $LOG.3  $LOG.4
    mv $LOG.2  $LOG.3
    mv $LOG.1  $LOG.2
    mv $LOG.0  $LOG.1
    mv ../$LOG $LOG.0
    cd ..
    cp /dev/null $LOG
    chown news   $LOG
    chmod 666    $LOG
end
