daily revision 1.16.4.1
1#!/bin/sh - 2# 3# $NetBSD: daily,v 1.16.4.1 1996/07/02 23:23:29 jtc Exp $ 4# 5# form: @(#)daily 5.12 (Berkeley) 5/24/91 6# 7PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local 8host=`hostname -s` 9echo "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 40cd /tmp 41TMP=daily.$$ 42find / \( ! -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 > $TMP 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 50echo "" 51echo "Possible core dumps:" 52egrep '\.core' $TMP 53 54echo "" 55echo "Deleted files:" 56egrep -v '\.core' $TMP 57 58rm -f $TMP 59 60msgs -c 61 62if [ -f /etc/news.expire ]; then 63 /etc/news.expire 64fi 65 66if [ -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 ; 74fi 75 76echo "" 77echo "Running calendar:" 78calendar -a 79 80# Rotation of mail log now handled automatically by cron and 'newsyslog' 81 82if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then 83 echo "" 84 echo "Cleaning up UUCP:" 85 echo /etc/uuclean.daily | su daemon 86fi 87 88echo "" 89echo "" 90echo "Checking subsystem status:" 91echo "" 92echo "disks:" 93df -k 94echo "" 95dump W 96echo "" 97 98 99echo "" 100echo "mail:" 101mailq 102 103if [ -d /var/spool/uucp ]; then 104 echo "" 105 echo "uucp:" 106 uustat -a 107fi 108 109echo "" 110echo "network:" 111netstat -i 112echo "" 113ruptime 114 115echo "" 116echo "Checking filesystems:" 117fsck -n | grep -v '^\*\* Phase' 118 119echo "" 120if [ -f /etc/Distfile ]; then 121 echo "Running rdist:" 122 rdist -f /etc/Distfile 123fi 124 125sh /etc/security 2>&1 | mail -s "daily insecurity output" root 126