[BACK]Return to daily CVS log [TXT][DIR] Up to [local] / src / etc

Annotation of src/etc/daily, Revision 1.4

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