Annotation of src/etc/daily, Revision 1.8
1.1 deraadt 1: #!/bin/sh -
2: #
1.8 ! downsj 3: # $OpenBSD: daily,v 1.7 1996/07/12 21:34:47 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.7 deraadt 47: cd /tmp
48: TMP=daily.$$
49: rm -f $TMP
50: echo -n > $TMP
51: find / \( ! -fstype local -o -fstype rdonly -o -fstype fdesc \
52: -o -fstype kernfs -o -fstype procfs \) -a -prune -o \
53: -name 'lost+found' -a -prune -o \
54: -name '*.core' -a -print > $TMP
1.5 deraadt 55: # \( -name '[#,]*' -o -name '.#*' -o -name a.out \
56: # -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \
57: # -a -atime +3 -exec rm -f -- {} \; -a -print > $TMP
1.1 deraadt 58:
59: echo ""
60: echo "Possible core dumps:"
61: egrep '\.core' $TMP
62:
1.7 deraadt 63: #echo ""
64: #echo "Deleted files:"
65: #egrep -v '\.core' $TMP
1.1 deraadt 66:
67: rm -f $TMP
68:
69: msgs -c
70:
71: if [ -f /etc/news.expire ]; then
72: /etc/news.expire
73: fi
74:
75: if [ -f /var/account/acct ]; then
76: echo "" ;
77: echo "Purging accounting records:" ;
78: mv /var/account/acct.2 /var/account/acct.3 ;
79: mv /var/account/acct.1 /var/account/acct.2 ;
80: mv /var/account/acct.0 /var/account/acct.1 ;
81: cp /var/account/acct /var/account/acct.0 ;
82: sa -sq ;
83: fi
84:
85: echo ""
86: echo "Running calendar:"
87: calendar -a
88:
89: # Rotation of mail log now handled automatically by cron and 'newsyslog'
90:
91: if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then
92: echo ""
93: echo "Cleaning up UUCP:"
94: echo /etc/uuclean.daily | su daemon
95: fi
96:
97: echo ""
98: echo ""
99: echo "Checking subsystem status:"
100: echo ""
101: echo "disks:"
102: df -k
103: echo ""
104: dump W
105: echo ""
106:
107:
108: echo ""
109: echo "mail:"
110: mailq
111:
112: if [ -d /var/spool/uucp ]; then
113: echo ""
114: echo "uucp:"
115: uustat -a
116: fi
117:
118: echo ""
119: echo "network:"
120: netstat -i
121: echo ""
122: ruptime
123:
124: echo ""
1.8 ! downsj 125: echo "NOT checking filesystems."
! 126: #echo "Checking filesystems:"
! 127: #fsck -n | grep -v '^\*\* Phase'
1.1 deraadt 128:
129: echo ""
130: if [ -f /etc/Distfile ]; then
131: echo "Running rdist:"
132: rdist -f /etc/Distfile
133: fi
134:
135: sh /etc/security 2>&1 | mail -s "daily insecurity output" root