Annotation of src/etc/daily, Revision 1.6
1.1 deraadt 1: #!/bin/sh -
2: #
1.6 ! deraadt 3: # $OpenBSD: daily,v 1.5 1996/06/16 14:39:24 deraadt Exp $
1.1 deraadt 4: #
5: PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local
6: host=`hostname -s`
7: echo "Subject: $host daily run output"
8:
1.2 david 9: if [ -f /etc/daily.local ];then
10: echo ""
11: echo "Running daily.local:"
12: . /etc/daily.local
13: fi
14:
1.1 deraadt 15: echo ""
16: echo "Removing scratch and junk files:"
1.5 deraadt 17: # XXX NOT REMOVING UNTIL SECURITY BUG IS FIXED"
18: #if [ -d /tmp -a ! -h /tmp ]; then
19: # cd /tmp && {
20: # find . -type f -atime +3 -exec rm -f -- {} \;
21: # find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
22: # >/dev/null 2>&1; }
23: #fi
1.1 deraadt 24:
1.5 deraadt 25: # XXX NOT REMOVING UNTIL SECURITY BUG IS FIXED
26: #if [ -d /var/tmp -a ! -h /var/tmp ]; then
27: # cd /var/tmp && {
28: # find . ! -name . -atime +7 -exec rm -f -- {} \;
29: # find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
30: # >/dev/null 2>&1; }
31: #fi
1.1 deraadt 32:
1.3 deraadt 33: # Additional junk directory cleanup would go like this:
34: #if [ -d /scratch -a ! -h /scratch ]; then
35: # cd /scratch && {
36: # find . ! -name . -atime +1 -exec rm -f -- {} \;
37: # find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
38: # >/dev/null 2>&1; }
39: #fi
1.1 deraadt 40:
1.6 ! deraadt 41: #if [ -d /var/rwho -a ! -h /var/rwho ] ; then
! 42: # cd /var/rwho && {
1.5 deraadt 43: # XXX NOT REMOVING UNTIL SECURITY BUG IS FIXED
44: # find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
1.6 ! deraadt 45: #fi
1.1 deraadt 46:
1.5 deraadt 47: # XXX NOT REMOVING UNTIL SECURITY BUG IS FIXED
48: #cd /tmp
49: #TMP=daily.$$
50: #find / \( ! -fstype local -o -fstype rdonly -o -fstype fdesc \
51: # -o -fstype kernfs -o -fstype procfs \) -a -prune -o \
52: # -name 'lost+found' -a -prune -o \
53: # -name '*.core' -a -print -o \
54: # \( -name '[#,]*' -o -name '.#*' -o -name a.out \
55: # -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \
56: # -a -atime +3 -exec rm -f -- {} \; -a -print > $TMP
1.1 deraadt 57:
58: echo ""
59: echo "Possible core dumps:"
60: egrep '\.core' $TMP
61:
62: echo ""
63: echo "Deleted files:"
64: egrep -v '\.core' $TMP
65:
66: rm -f $TMP
67:
68: msgs -c
69:
70: if [ -f /etc/news.expire ]; then
71: /etc/news.expire
72: fi
73:
74: if [ -f /var/account/acct ]; then
75: echo "" ;
76: echo "Purging accounting records:" ;
77: mv /var/account/acct.2 /var/account/acct.3 ;
78: mv /var/account/acct.1 /var/account/acct.2 ;
79: mv /var/account/acct.0 /var/account/acct.1 ;
80: cp /var/account/acct /var/account/acct.0 ;
81: sa -sq ;
82: fi
83:
84: echo ""
85: echo "Running calendar:"
86: calendar -a
87:
88: # Rotation of mail log now handled automatically by cron and 'newsyslog'
89:
90: if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then
91: echo ""
92: echo "Cleaning up UUCP:"
93: echo /etc/uuclean.daily | su daemon
94: fi
95:
96: echo ""
97: echo ""
98: echo "Checking subsystem status:"
99: echo ""
100: echo "disks:"
101: df -k
102: echo ""
103: dump W
104: echo ""
105:
106:
107: echo ""
108: echo "mail:"
109: mailq
110:
111: if [ -d /var/spool/uucp ]; then
112: echo ""
113: echo "uucp:"
114: uustat -a
115: fi
116:
117: echo ""
118: echo "network:"
119: netstat -i
120: echo ""
121: ruptime
122:
123: echo ""
124: echo "Checking filesystems:"
125: fsck -n | grep -v '^\*\* Phase'
126:
127: echo ""
128: if [ -f /etc/Distfile ]; then
129: echo "Running rdist:"
130: rdist -f /etc/Distfile
131: fi
132:
133: sh /etc/security 2>&1 | mail -s "daily insecurity output" root