Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

134 lines
2.7 KiB

#!/bin/sh -
#
# @(#)daily 5.12 (Berkeley) 5/24/91
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local
host=`hostname -s`
echo "Subject: $host daily run output"
if [ -f /etc/daily.local ];then
echo ""
echo "Running daily.local:"
. /etc/daily.local
fi
echo ""
echo "Removing scratch and junk files:"
if [ -d /tmp -a ! -h /tmp ]; then
cd /tmp && {
find . -type f -atime +3 -exec rm -f -- {} \;
find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
>/dev/null 2>&1; }
fi
if [ -d /var/tmp -a ! -h /var/tmp ]; then
cd /var/tmp && {
find . ! -name . -atime +7 -exec rm -f -- {} \;
find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
>/dev/null 2>&1; }
fi
if [ -d /scratch -a ! -h /scratch ]; then
cd /scratch && {
find . ! -name . -atime +1 -exec rm -f -- {} \;
find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
>/dev/null 2>&1; }
fi
# XXX should go away/be replaced by nvi version
if [ -d /var/preserve -a ! -h /var/preserve ]; then
cd /var/preserve && {
find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
fi
if [ -d /var/rwho -a ! -h /var/rwho ] ; then
cd /var/rwho && {
find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
fi
cd /tmp
TMP=daily.$$
find / \( ! -fstype local -o -fstype rdonly -o -fstype fdesc \
-o -fstype kernfs -o -fstype procfs \) -a -prune -o \
-name 'lost+found' -a -prune -o \
-name '*.core' -a -print -o \
\( -name '[#,]*' -o -name '.#*' -o -name a.out \
-o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \
-a -atime +3 -exec rm -f -- {} \; -a -print > $TMP
echo ""
echo "Possible core dumps:"
egrep '\.core' $TMP
echo ""
echo "Deleted files:"
egrep -v '\.core' $TMP
rm -f $TMP
msgs -c
if [ -f /etc/news.expire ]; then
/etc/news.expire
fi
if [ -f /var/account/acct ]; then
echo "" ;
echo "Purging accounting records:" ;
mv /var/account/acct.2 /var/account/acct.3 ;
mv /var/account/acct.1 /var/account/acct.2 ;
mv /var/account/acct.0 /var/account/acct.1 ;
cp /var/account/acct /var/account/acct.0 ;
sa -sq ;
fi
echo ""
echo "Running calendar:"
calendar -a
# Rotation of mail log now handled automatically by cron and 'newsyslog'
if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then
echo ""
echo "Cleaning up UUCP:"
echo /etc/uuclean.daily | su daemon
fi
echo ""
echo ""
echo "Checking subsystem status:"
echo ""
echo "disks:"
df -k
echo ""
dump W
echo ""
echo ""
echo "mail:"
mailq
if [ -d /var/spool/uucp ]; then
echo ""
echo "uucp:"
uustat -a
fi
echo ""
echo "network:"
netstat -i
echo ""
ruptime
echo ""
echo "Checking filesystems:"
fsck -n | grep -v '^\*\* Phase'
echo ""
if [ -f /etc/Distfile ]; then
echo "Running rdist:"
rdist -f /etc/Distfile
fi
sh /etc/security 2>&1 | mail -s "daily insecurity output" root