3 # @(#)daily 5.12 (Berkeley) 5/24/91
5 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local
7 echo "Subject: $host daily run output"
11 echo "Removing scratch and junk files:"
14 find . -type f -atime +3 -exec rm -f -- {} \;
15 find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
19 if [ -d /var/tmp ]; then
21 find . ! -name . -atime +7 -exec rm -f -- {} \;
22 find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
26 if [ -d /scratch ]; then
28 find . ! -name . ! -fstype local -a -prune -o \
29 -atime +1 -exec rm -f -- {} \;
30 find . ! -name . ! -fstype local -a -prune -o \
31 -type d -mtime +1 -exec rmdir -- {} \; \
35 if [ -d /var/preserve ]; then
37 find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
40 if [ -d /var/rwho ] ; then
42 find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
46 # This is not safe, you need to decide what is appropriate for your
47 # system. Leave a warning note for now.
48 echo "You did not enable the cleaning of / in /etc/daily!"
50 #find / ! -fstype local -a -prune -o \
51 # \( -name '[#,]*' -o -name '.#*' -o -name a.out -o -name *.core \
52 # -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \
53 # -a -atime +3 -exec rm -f -- {} \;
56 if [ -f /etc/news.expire ]; then
60 if [ -d /var/account ] ; then
62 echo "Purging accounting records:"
64 if [ -f acct.2 ] ; then mv -f acct.2 acct.3 ; fi
65 if [ -f acct.1 ] ; then mv -f acct.1 acct.2 ; fi
66 if [ -f acct.0 ] ; then mv -f acct.0 acct.1 ; fi
74 echo "Backup passwd and group files:"
75 if cmp -s $bak/master.passwd.bak /etc/master.passwd; then :; else
76 echo "$host passwd diffs:"
77 diff $bak/master.passwd.bak /etc/master.passwd
78 mv $bak/master.passwd.bak $bak/master.passwd.bak2
79 cp -p /etc/master.passwd $bak/master.passwd.bak
81 if cmp -s $bak/group.bak /etc/group; then :; else
82 mv $bak/group.bak $bak/group.bak2
83 cp -p /etc/group $bak/group.bak
85 if cmp -s $bak/aliases.bak /etc/aliases; then :; else
86 mv $bak/aliases.bak $bak/aliases.bak2
87 cp -p /etc/aliases $bak/aliases.bak
89 if [ -f /etc/Distfile ]; then
90 if cmp -s $bak/Distfile.bak /etc/Distfile; then :; else
91 mv $bak/Distfile.bak $bak/Distfile.bak2
92 cp /etc/Distfile $bak/Distfile.bak
97 echo "Running calendar:"
101 echo "Rotating mail log:"
104 if [ -f maillog.6 ]; then mv -f maillog.6 maillog.7; fi
105 if [ -f maillog.5 ]; then mv -f maillog.5 maillog.6; fi
106 if [ -f maillog.4 ]; then mv -f maillog.4 maillog.5; fi
107 if [ -f maillog.3 ]; then mv -f maillog.3 maillog.4; fi
108 if [ -f maillog.2 ]; then mv -f maillog.2 maillog.3; fi
109 if [ -f maillog.1 ]; then mv -f maillog.1 maillog.2; fi
110 if [ -f maillog.0 ]; then mv -f maillog.0 maillog.1; fi
111 mv -f maillog maillog.0
114 kill -1 `cat /var/run/syslog.pid`
117 if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then
119 echo "Cleaning up UUCP:"
120 echo /etc/uuclean.daily | su daemon
125 echo "Checking subsystem status:"
138 if [ -d /var/spool/uucp ]; then
151 echo "Checking filesystems:"
152 fsck -n | grep -v '^\*\* Phase'
155 if [ -f /etc/Distfile ]; then
156 echo "Running rdist:"
157 rdist -f /etc/Distfile
160 sh /etc/security 2>&1 | mail -s "daily insecurity output" root