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