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