arrange for all log rotations to be handled by /usr/bin/newsyslog

This commit is contained in:
cgd 1993-05-21 14:45:16 +00:00
parent 90beb7e48c
commit 640e7bf41e
6 changed files with 45 additions and 72 deletions

View File

@ -6,9 +6,9 @@ NOOBJ= oobj
# -rw-r--r--
BIN1= aliases csh.cshrc csh.login csh.logout daily dm.conf \
ftpusers gettytab group hosts hosts.equiv hosts.lpd inetd.conf \
man.conf monthly motd myname netstart phones printcap protocols rc \
rc.local remote security services shells syslog.conf ttys weekly \
etc.${MACHINE}/disktab rpc
man.conf monthly motd myname netstart newsyslog.conf phones \
printcap protocols rc rc.local remote security services shells \
syslog.conf ttys weekly etc.${MACHINE}/disktab rpc
# -rw-rw-rw-
BIN2= motd

View File

@ -1,4 +1,5 @@
# /var/cron/tabs/root - root's crontab for Vixie's cron
# /var/cron/tabs/root - root's crontab for NetBSD
# $Id: crontab,v 1.5 1993/05/21 14:45:17 cgd Exp $
#
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
@ -7,6 +8,11 @@ HOME=/var/log
#minute hour mday month wday command
#
#0/15 * * * * /usr/libexec/atrun
#
# rotate log files every hour, if necessary
0 * * * * /usr/bin/newsyslog
#
# do daily/weekly/monthly maintenance
0 2 * * * sh /etc/daily
30 3 * * 6 sh /etc/weekly
30 5 1 * * sh /etc/monthly

View File

@ -50,15 +50,18 @@ if [ -f /etc/news.expire ]; then
/etc/news.expire
fi
if [ -f /var/account ]; then
echo "" ;
echo "Purging accounting records:" ;
mv /var/account/acct.2 /var/account/acct.3 ;
mv /var/account/acct.1 /var/account/acct.2 ;
mv /var/account/acct.0 /var/account/acct.1 ;
cp /var/account/acct /var/account/acct.0 ;
sa -s > /dev/null ;
fi
# Rotation of accounting log now handled automatically by cron and 'newsyslog'
# eventually might want to replace "sa" though...
#
#if [ -f /var/account ]; then
# echo "" ;
# echo "Purging accounting records:" ;
# mv /var/account/acct.2 /var/account/acct.3 ;
# mv /var/account/acct.1 /var/account/acct.2 ;
# mv /var/account/acct.0 /var/account/acct.1 ;
# cp /var/account/acct /var/account/acct.0 ;
# sa -s > /dev/null ;
#fi
echo ""
echo "Backup passwd and group files:"
@ -98,25 +101,7 @@ if [ -d /usr/share/man -a -f /usr/share/man/makewhatis.sed ]; then
rm -f /tmp/whatis.db.$$
fi
echo ""
echo "Rotating mail log:"
cd /var/log
rm -f maillog.7.Z
if [ -f maillog.6.Z ]; then mv -f maillog.6.Z maillog.7.Z; fi
if [ -f maillog.5.Z ]; then mv -f maillog.5.Z maillog.6.Z; fi
if [ -f maillog.4.Z ]; then mv -f maillog.4.Z maillog.5.Z; fi
if [ -f maillog.3.Z ]; then mv -f maillog.3.Z maillog.4.Z; fi
if [ -f maillog.2.Z ]; then mv -f maillog.2.Z maillog.3.Z; fi
if [ -f maillog.1.Z ]; then mv -f maillog.1.Z maillog.2.Z; fi
if [ -f maillog.0.Z ]; then mv -f maillog.0.Z maillog.1.Z; fi
mv -f maillog maillog.0
compress -f maillog.0
cp /dev/null maillog
chmod 600 maillog
kill -1 `cat /var/run/syslog.pid`
cd /
# Rotation of mail log now handled automatically by cron and 'newsyslog'
if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then
echo ""

View File

@ -10,33 +10,12 @@ echo "Subject: $host monthly run output"
# echo "Doing login accounting:"
# ac -p | sort -nr +1
echo ""
echo -n "Rotating log files:"
cd /var/log
for i in kerberos.log lpd-errs wtmp aculog; do
echo -n " $i"
if [ -f $i.5.Z ]; then mv -f $i.5.Z $i.6.Z; fi
if [ -f $i.4.Z ]; then mv -f $i.4.Z $i.5.Z; fi
if [ -f $i.3.Z ]; then mv -f $i.3.Z $i.4.Z; fi
if [ -f $i.2.Z ]; then mv -f $i.2.Z $i.3.Z; fi
if [ -f $i.1.Z ]; then mv -f $i.1.Z $i.2.Z; fi
if [ -f $i.0.Z ]; then mv -f $i.0.Z $i.1.Z; fi
mv -f $i $i.0
compress -f $i.0
cp /dev/null $i
chmod 640 $i
done
echo "."
# Rotation of these logs now handled automatically by cron and 'newsyslog':
# kerberos.log
# lpd-errs
# wtmp
# aculog
# cron
echo ""
echo "Rotating cron log:"
cd /var/cron
rm -f log.3.Z
if [ -f log.2.Z ]; then mv -f log.2.Z log.3.Z; fi
if [ -f log.1.Z ]; then mv -f log.1.Z log.2.Z; fi
if [ -f log.0.Z ]; then mv -f log.0.Z log.1.Z; fi
mv -f log log.0
compress -f log.0
cp /dev/null log
chmod 600 log
echo "."
echo "Nothing to do!"
#echo "."

13
etc/newsyslog.conf Normal file
View File

@ -0,0 +1,13 @@
# configuration file for newsyslog
# $Id: newsyslog.conf,v 1.1 1993/05/21 14:45:20 cgd Exp $
#
# logfilename owner.group mode ngen size time [ZB]
/var/account/acct 640 5 * 24 ZB
/var/cron/log 600 3 10 * Z
/var/log/aculog 640 7 * 24 Z
/var/log/kerberos.log 640 7 * 24 Z
/var/log/lpd-errs 640 7 10 * Z
/var/log/maillog 600 7 * 24 Z
/var/log/messages 644 5 30 * Z
/var/log/wtmp 640 7 * 168 ZB
/var/log/xferlog 640 7 750 * Z

View File

@ -43,17 +43,7 @@ if [ -f /usr/lib/uucp/clean.weekly ]; then
fi
echo ""
echo "Rotating messages:"
cd /var/log
if [ -f messages.2.Z ]; then mv -f messages.2.Z messages.3.Z; fi
if [ -f messages.1.Z ]; then mv -f messages.1.Z messages.2.Z; fi
if [ -f messages.0.Z ]; then mv -f messages.0.Z messages.1.Z; fi
mv -f messages messages.0
compress -f messages.0
cp /dev/null messages
chmod 644 messages
kill -1 `cat /var/run/syslog.pid`
cd /
# Rotation of message log now handled automatically by cron and 'newsyslog'
echo ""
echo "Rebuilding locate database:"