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