Listing 1: Monthly cron job to create HTML pages for dial-up usage
#!/bin/sh
#
# Listing 1 -- Monthly cron job to create HTML pages
# for dialup usage.
#
SQHOME=/home/squid
SLOGHOME=/home/squid/logs
SXTRHOME=/home/squid/logs
SCRHOME=/home/thomas/sys_admin/squid
HTML=/db/infosys/html/dadasp/admin/netblazer
MONTH=`date +%h`
DAY=`date +%d`
cd $SQHOME
mv squidlog $SLOGHOME/squidlog.$MONTH.$DAY
touch squidlog
kill -HUP `ps -elf | grep syslog | grep -v grep | awk '{ print $4 }'`
awk -f $SCRHOME/extract.awk $SLOGHOME/squidlog.$MONTH.$DAY | \
sort +1 > $SXTRHOME/extracted.1.$MONTH
grep seconds $SLOGHOME/squidlog.$MONTH.$DAY | grep -v inbound | \
sort +5 > $SXTRHOME/extracted.2.$MONTH
compress $SLOGHOME/squidlog.$MONTH.$DAY
$SQHOME/reports/line.pl $SXTRHOME/extracted.1.$MONTH > \
$HTML/$MONTH/hreport.html
$SQHOME/reports/user.pl $SXTRHOME/extracted.2.$MONTH > \
$HTML/$MONTH/ureport.html
# End of File
|