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 bak=/var/backups 9 10 # IF YOU WANT SCRATCH AND JUNK FILES REMOVED, uncomment the following lines. 11 #echo "" 12 #echo "Removing scratch and junk files:" 13 #if [ -d /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 ]; 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 #if [ -d /scratch ]; then 28 # cd /scratch && { 29 # find . ! -name . -atime +1 -exec rm -f -- {} \; 30 # find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \ 31 # >/dev/null 2>&1; } 32 #fi 33 # 34 #if [ -d /var/preserve ]; then 35 # cd /var/preserve && { 36 # find . ! -name . -mtime +7 -exec rm -f -- {} \; ; } 37 #fi 38 # 39 #if [ -d /var/rwho ] ; then 40 # cd /var/rwho && { 41 # find . ! -name . -mtime +7 -exec rm -f -- {} \; ; } 42 #fi 43 # 44 #cd /tmp 45 #find / \( ! -fstype local -o -fstype fdesc -o -fstype kernfs \) -a -prune -o \ 46 # \( -name '[#,]*' -o -name '.#*' -o -name a.out -o -name core \ 47 # -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \ 48 # -a -atime +3 -exec rm -f -- {} \; 49 50 #msgs -c 51 52 if [ -f /etc/news.expire ]; then 53 /etc/news.expire 54 fi 55 56 #if [ -f /var/account ]; then 57 # echo "" ; 58 # echo "Purging accounting records:" ; 59 # mv /var/account/acct.2 /var/account/acct.3 ; 60 # mv /var/account/acct.1 /var/account/acct.2 ; 61 # mv /var/account/acct.0 /var/account/acct.1 ; 62 # cp /var/account/acct /var/account/acct.0 ; 63 # sa -s > /dev/null ; 64 #fi 65 66 echo "" 67 echo "Backup passwd and group files:" 68 if cmp -s $bak/master.passwd.bak /etc/master.passwd; then :; else 69 echo "$host passwd diffs:" 70 diff $bak/master.passwd.bak /etc/master.passwd 71 mv $bak/master.passwd.bak $bak/master.passwd.bak2 72 cp -p /etc/master.passwd $bak/master.passwd.bak 73 fi 74 if cmp -s $bak/group.bak /etc/group; then :; else 75 mv $bak/group.bak $bak/group.bak2 76 cp -p /etc/group $bak/group.bak 77 fi 78 if cmp -s $bak/aliases.bak /etc/aliases; then :; else 79 mv $bak/aliases.bak $bak/aliases.bak2 80 cp -p /etc/aliases $bak/aliases.bak 81 fi 82 if [ -f /etc/Distfile ]; then 83 if cmp -s $bak/Distfile.bak /etc/Distfile; then :; else 84 mv $bak/Distfile.bak $bak/Distfile.bak2 85 cp /etc/Distfile $bak/Distfile.bak 86 fi 87 fi 88 89 echo "" 90 echo "Running calendar:" 91 calendar -a 92 93 # Rotation of mail log now handled automatically by cron and 'newsyslog' 94 95 if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then 96 echo "" 97 echo "Cleaning up UUCP:" 98 echo /etc/uuclean.daily | su daemon 99 fi 100 101 echo "" 102 echo "" 103 echo "Checking subsystem status:" 104 echo "" 105 echo "disks:" 106 df -k 107 echo "" 108 dump W 109 echo "" 110 111 112 echo "" 113 echo "mail:" 114 mailq 115 116 if [ -d /var/spool/uucp ]; then 117 echo "" 118 echo "uucp:" 119 uustat -a 120 fi 121 122 echo "" 123 echo "network:" 124 netstat -i 125 echo "" 126 ruptime 127 128 echo "" 129 echo "Checking filesystems:" 130 fsck -n | grep -v '^\*\* Phase' 131 132 echo "" 133 if [ -f /etc/Distfile ]; then 134 echo "Running rdist:" 135 rdist -f /etc/Distfile 136 fi 137 138 sh /etc/security 2>&1 | mail -s "daily insecurity output" root 139