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

Annotation of src/etc/daily, Revision 1.2

1.1       deraadt     1: #!/bin/sh -
                      2: #
                      3: #      @(#)daily       5.12 (Berkeley) 5/24/91
                      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:
                     31: if [ -d /scratch -a ! -h /scratch ]; then
                     32:        cd /scratch && {
                     33:        find . ! -name . -atime +1 -exec rm -f -- {} \;
                     34:        find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
                     35:            >/dev/null 2>&1; }
                     36: fi
                     37:
                     38: # XXX should go away/be replaced by nvi version
                     39: if [ -d /var/preserve -a ! -h /var/preserve ]; then
                     40:        cd /var/preserve && {
                     41:        find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
                     42: fi
                     43:
                     44: if [ -d /var/rwho -a ! -h /var/rwho ] ; then
                     45:        cd /var/rwho && {
                     46:        find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
                     47: fi
                     48:
                     49: cd /tmp
                     50: TMP=daily.$$
                     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 -o \
                     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
                     58:
                     59: echo ""
                     60: echo "Possible core dumps:"
                     61: egrep '\.core' $TMP
                     62:
                     63: echo ""
                     64: echo "Deleted files:"
                     65: egrep -v '\.core' $TMP
                     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 ""
                    125: echo "Checking filesystems:"
                    126: fsck -n | grep -v '^\*\* Phase'
                    127:
                    128: echo ""
                    129: if [ -f /etc/Distfile ]; then
                    130:        echo "Running rdist:"
                    131:        rdist -f /etc/Distfile
                    132: fi
                    133:
                    134: sh /etc/security 2>&1 | mail -s "daily insecurity output" root