1993-03-21 12:45:37 +03:00
|
|
|
#!/bin/sh -
|
|
|
|
#
|
1996-07-03 03:10:35 +04:00
|
|
|
# $NetBSD: daily,v 1.17 1996/07/02 23:10:35 jtc Exp $
|
1996-03-26 07:21:27 +03:00
|
|
|
#
|
|
|
|
# form: @(#)daily 5.12 (Berkeley) 5/24/91
|
1993-03-21 12:45:37 +03:00
|
|
|
#
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local
|
|
|
|
host=`hostname -s`
|
|
|
|
echo "Subject: $host daily run output"
|
|
|
|
|
1996-07-03 03:10:35 +04:00
|
|
|
#echo ""
|
|
|
|
#echo "Removing scratch and junk files:"
|
|
|
|
#if [ -d /tmp -a ! -h /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 -a ! -h /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
|
1994-02-19 10:54:08 +03:00
|
|
|
|
1996-03-25 12:23:15 +03:00
|
|
|
# Additional junk directory cleanup would go like this:
|
|
|
|
#if [ -d /scratch -a ! -h /scratch ]; then
|
|
|
|
# cd /scratch && {
|
|
|
|
# find . ! -name . -atime +1 -exec rm -f -- {} \;
|
|
|
|
# find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
|
|
|
|
# >/dev/null 2>&1; }
|
|
|
|
#fi
|
1994-02-19 10:54:08 +03:00
|
|
|
|
1996-07-03 03:10:35 +04:00
|
|
|
#if [ -d /var/rwho -a ! -h /var/rwho ] ; then
|
|
|
|
# cd /var/rwho && {
|
|
|
|
# find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
|
|
|
|
#fi
|
1994-02-19 10:54:08 +03:00
|
|
|
|
|
|
|
cd /tmp
|
|
|
|
TMP=daily.$$
|
|
|
|
find / \( ! -fstype local -o -fstype rdonly -o -fstype fdesc \
|
1994-10-18 19:52:56 +03:00
|
|
|
-o -fstype kernfs -o -fstype procfs \) -a -prune -o \
|
1994-02-19 10:54:08 +03:00
|
|
|
-name 'lost+found' -a -prune -o \
|
1996-07-03 03:10:35 +04:00
|
|
|
-name '*.core' -a -print > $TMP
|
|
|
|
# \( -name '[#,]*' -o -name '.#*' -o -name a.out \
|
|
|
|
# -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \
|
|
|
|
# -a -atime +3 -exec rm -f -- {} \; -a -print > $TMP
|
1994-02-19 10:54:08 +03:00
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Possible core dumps:"
|
|
|
|
egrep '\.core' $TMP
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Deleted files:"
|
|
|
|
egrep -v '\.core' $TMP
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1994-02-19 10:56:02 +03:00
|
|
|
rm -f $TMP
|
|
|
|
|
1994-02-19 10:54:08 +03:00
|
|
|
msgs -c
|
1994-02-18 08:40:22 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
if [ -f /etc/news.expire ]; then
|
|
|
|
/etc/news.expire
|
|
|
|
fi
|
|
|
|
|
1994-02-26 06:29:23 +03:00
|
|
|
if [ -f /var/account/acct ]; 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 -sq ;
|
|
|
|
fi
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
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
|