1993-03-21 12:45:37 +03:00
|
|
|
#!/bin/sh -
|
|
|
|
#
|
|
|
|
# @(#)daily 5.12 (Berkeley) 5/24/91
|
|
|
|
#
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local
|
|
|
|
host=`hostname -s`
|
|
|
|
echo "Subject: $host daily run output"
|
|
|
|
bak=/var/backups
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Removing scratch and junk files:"
|
|
|
|
if [ -d /tmp ]; then
|
|
|
|
cd /tmp && {
|
|
|
|
find . -type f -atime +3 -exec rm -f -- {} \;
|
|
|
|
find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
|
|
|
|
>/dev/null 2>&1; }
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d /var/tmp ]; then
|
|
|
|
cd /var/tmp && {
|
|
|
|
find . ! -name . -atime +7 -exec rm -f -- {} \;
|
|
|
|
find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
|
|
|
|
>/dev/null 2>&1; }
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d /scratch ]; then
|
|
|
|
cd /scratch && {
|
|
|
|
find . ! -name . -atime +1 -exec rm -f -- {} \;
|
|
|
|
find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
|
|
|
|
>/dev/null 2>&1; }
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d /var/preserve ]; then
|
|
|
|
cd /var/preserve && {
|
|
|
|
find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d /var/rwho ] ; then
|
|
|
|
cd /var/rwho && {
|
|
|
|
find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd /tmp
|
1993-04-09 14:25:02 +04:00
|
|
|
find / \( ! -fstype local -o -fstype fdesc -o -fstype kernfs \) -a -prune -o \
|
1993-03-21 12:45:37 +03:00
|
|
|
\( -name '[#,]*' -o -name '.#*' -o -name a.out -o -name core \
|
|
|
|
-o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \
|
|
|
|
-a -atime +3 -exec rm -f -- {} \;
|
1993-04-02 11:56:43 +04:00
|
|
|
#msgs -c
|
1993-03-21 12:45:37 +03:00
|
|
|
if [ -f /etc/news.expire ]; then
|
|
|
|
/etc/news.expire
|
|
|
|
fi
|
|
|
|
|
1993-05-21 18:45:16 +04:00
|
|
|
# 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
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Backup passwd and group files:"
|
|
|
|
if cmp -s $bak/master.passwd.bak /etc/master.passwd; then :; else
|
|
|
|
echo "$host passwd diffs:"
|
|
|
|
diff $bak/master.passwd.bak /etc/master.passwd
|
|
|
|
mv $bak/master.passwd.bak $bak/master.passwd.bak2
|
|
|
|
cp -p /etc/master.passwd $bak/master.passwd.bak
|
|
|
|
fi
|
|
|
|
if cmp -s $bak/group.bak /etc/group; then :; else
|
|
|
|
mv $bak/group.bak $bak/group.bak2
|
|
|
|
cp -p /etc/group $bak/group.bak
|
|
|
|
fi
|
|
|
|
if cmp -s $bak/aliases.bak /etc/aliases; then :; else
|
|
|
|
mv $bak/aliases.bak $bak/aliases.bak2
|
|
|
|
cp -p /etc/aliases $bak/aliases.bak
|
|
|
|
fi
|
|
|
|
if [ -f /etc/Distfile ]; then
|
|
|
|
if cmp -s $bak/Distfile.bak /etc/Distfile; then :; else
|
|
|
|
mv $bak/Distfile.bak $bak/Distfile.bak2
|
|
|
|
cp /etc/Distfile $bak/Distfile.bak
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Running calendar:"
|
|
|
|
calendar -a
|
|
|
|
|
1993-05-21 18:45:16 +04:00
|
|
|
# Rotation of mail log now handled automatically by cron and 'newsyslog'
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then
|
|
|
|
echo ""
|
|
|
|
echo "Cleaning up UUCP:"
|
|
|
|
echo /etc/uuclean.daily | su daemon
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
echo "Checking subsystem status:"
|
|
|
|
echo ""
|
|
|
|
echo "disks:"
|
|
|
|
df -k
|
|
|
|
echo ""
|
|
|
|
dump W
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "mail:"
|
|
|
|
mailq
|
|
|
|
|
|
|
|
if [ -d /var/spool/uucp ]; then
|
|
|
|
echo ""
|
|
|
|
echo "uucp:"
|
1993-04-02 11:56:43 +04:00
|
|
|
uustat -a
|
1993-03-21 12:45:37 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "network:"
|
|
|
|
netstat -i
|
|
|
|
echo ""
|
|
|
|
ruptime
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Checking filesystems:"
|
|
|
|
fsck -n | grep -v '^\*\* Phase'
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
if [ -f /etc/Distfile ]; then
|
|
|
|
echo "Running rdist:"
|
|
|
|
rdist -f /etc/Distfile
|
|
|
|
fi
|
|
|
|
|
1993-10-26 04:39:45 +03:00
|
|
|
sh /etc/security 2>&1 | mail -s "daily insecurity output" root
|