add configuration file for daily, weekly, montly, as
daily.conf, weekly.conf and montly.conf. the file allows each action taken by all scripts to be turned on or off.
This commit is contained in:
parent
95a6463b3e
commit
016b324a94
173
etc/daily
173
etc/daily
|
@ -1,13 +1,20 @@
|
|||
#!/bin/sh -
|
||||
#
|
||||
# $NetBSD: daily,v 1.17 1996/07/02 23:10:35 jtc Exp $
|
||||
# $NetBSD: daily,v 1.18 1997/01/05 11:21:09 mrg Exp $
|
||||
#
|
||||
# form: @(#)daily 5.12 (Berkeley) 5/24/91
|
||||
#
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
host=`hostname -s`
|
||||
echo "Subject: $host daily run output"
|
||||
|
||||
umask 077
|
||||
|
||||
if [ -s /etc/daily.conf ]; then
|
||||
. /etc/daily.conf
|
||||
fi
|
||||
|
||||
#echo ""
|
||||
#echo "Removing scratch and junk files:"
|
||||
#if [ -d /tmp -a ! -h /tmp ]; then
|
||||
|
@ -37,33 +44,56 @@ echo "Subject: $host daily run output"
|
|||
# find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
|
||||
#fi
|
||||
|
||||
cd /tmp
|
||||
TMPDIR=/tmp/_daily.$$
|
||||
|
||||
if ! mkdir $TMPDIR; then
|
||||
echo can not create $TMPDIR.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! cd $TMPDIR; then
|
||||
echo can not cd to $TMPDIR.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TMP=daily.$$
|
||||
find / \( ! -fstype local -o -fstype rdonly -o -fstype fdesc \
|
||||
TMP2=daily2.$$
|
||||
|
||||
if [ x"$find_core" != xNO ] ; then
|
||||
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 > $TMP
|
||||
# \( -name '[#,]*' -o -name '.#*' -o -name a.out \
|
||||
# -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \
|
||||
# -a -atime +3 -exec rm -f -- {} \; -a -print > $TMP
|
||||
-name 'lost+found' -a -prune -o \
|
||||
-name '*.core' -a -print > $TMP
|
||||
# \( -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
|
||||
egrep '\.core' $TMP > $TMP2
|
||||
if [ -s $TMP2 ]; then
|
||||
echo ""
|
||||
echo "Possible core dumps:"
|
||||
cat $TMP2
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Deleted files:"
|
||||
egrep -v '\.core' $TMP
|
||||
# egrep -v '\.core' $TMP > $TMP2
|
||||
# if [ -s $TMP2 ]; then
|
||||
# echo ""
|
||||
# echo "Deleted files:"
|
||||
# cat $TMP2
|
||||
# fi
|
||||
|
||||
rm -f $TMP
|
||||
rm -f $TMP $TMP2
|
||||
fi
|
||||
|
||||
msgs -c
|
||||
if [ x"$run_msgs" != xNO ]; then
|
||||
msgs -c
|
||||
fi
|
||||
|
||||
if [ -f /etc/news.expire ]; then
|
||||
if [ x"$expire_news" != xNO -a -f /etc/news.expire ]; then
|
||||
/etc/news.expire
|
||||
fi
|
||||
|
||||
if [ -f /var/account/acct ]; then
|
||||
if [ x"$purge_accounting" != xNO -a -f /var/account/acct ]; then
|
||||
echo "" ;
|
||||
echo "Purging accounting records:" ;
|
||||
mv /var/account/acct.2 /var/account/acct.3 ;
|
||||
|
@ -73,53 +103,92 @@ if [ -f /var/account/acct ]; then
|
|||
sa -sq ;
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Running calendar:"
|
||||
calendar -a
|
||||
if [ x"$run_calendar" != xNO ]; then
|
||||
calendar -a > $TMP
|
||||
if [ -s $TMP ]; then
|
||||
echo ""
|
||||
echo "Running calendar:"
|
||||
cat $TMP
|
||||
fi
|
||||
rm -f $TMP
|
||||
fi
|
||||
|
||||
# Rotation of mail log now handled automatically by cron and 'newsyslog'
|
||||
|
||||
if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then
|
||||
if [ x"$check_uucp" != xNO -a -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 ""
|
||||
if [ x"$check_disks" != xNO ]; then
|
||||
df -k > $TMP
|
||||
dump W > $TMP2
|
||||
if [ -s $TMP -o -s $TMP2 ]; then
|
||||
echo ""
|
||||
echo "Checking subsystem status:"
|
||||
echo ""
|
||||
echo "disks:"
|
||||
if [ -s $TMP ]; then
|
||||
cat $TMP
|
||||
echo ""
|
||||
fi
|
||||
if [ -s $TMP2 ]; then
|
||||
cat $TMP2
|
||||
echo ""
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f $TMP $TMP2
|
||||
|
||||
echo ""
|
||||
echo "mail:"
|
||||
mailq
|
||||
if [ x"$check_mailq" != xNO ]; then
|
||||
mailq > $TMP
|
||||
if ! grep -q "^Mail queue is empty$" $TMP; then
|
||||
echo ""
|
||||
echo "mail:"
|
||||
cat $TMP
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d /var/spool/uucp ]; then
|
||||
rm -f $TMP
|
||||
|
||||
if [ x"$check_uucp" != xNO -a -d /var/spool/uucp ]; then
|
||||
uustat -a > $TMP
|
||||
if [ -s $TMP ]; then
|
||||
echo ""
|
||||
echo "uucp:"
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f $TMP
|
||||
|
||||
if [ x"$check_network" != xNO ]; then
|
||||
echo ""
|
||||
echo "uucp:"
|
||||
uustat -a
|
||||
echo "network:"
|
||||
netstat -i
|
||||
echo ""
|
||||
t=/var/rwho/*
|
||||
if [ "$t" != '/var/rwho/*' ]; then
|
||||
ruptime
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ x"$run_fsck" != xNO ]; then
|
||||
echo ""
|
||||
echo "Checking filesystems:"
|
||||
fsck -n | grep -v '^\*\* Phase'
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "network:"
|
||||
netstat -i
|
||||
echo ""
|
||||
ruptime
|
||||
|
||||
echo ""
|
||||
echo "Checking filesystems:"
|
||||
fsck -n | grep -v '^\*\* Phase'
|
||||
|
||||
echo ""
|
||||
if [ -f /etc/Distfile ]; then
|
||||
if [ x"$run_rdist" != xNO -a -f /etc/Distfile ]; then
|
||||
echo "Running rdist:"
|
||||
rdist -f /etc/Distfile
|
||||
fi
|
||||
|
||||
sh /etc/security 2>&1 | mail -s "daily insecurity output" root
|
||||
if [ x"$run_security" != xNO ]; then
|
||||
sh /etc/security 2>&1 | mail -s "daily insecurity output" root
|
||||
fi
|
||||
|
||||
rm -rf $TMPDIR
|
||||
|
||||
exit
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
# $NetBSD: daily.conf,v 1.1 1997/01/05 11:21:10 mrg Exp $
|
||||
#
|
||||
# see daily.conf(5) for more information.
|
||||
|
||||
find_core=YES
|
||||
expire_news=YES
|
||||
purge_accounting=YES
|
||||
run_msgs=YES
|
||||
run_calendar=YES
|
||||
check_uucp=YES
|
||||
check_disks=YES
|
||||
check_mailq=YES
|
||||
check_network=YES
|
||||
run_fsck=YES
|
||||
run_rdist=YES
|
||||
run_security=YES
|
15
etc/monthly
15
etc/monthly
|
@ -1,22 +1,21 @@
|
|||
#!/bin/sh -
|
||||
#
|
||||
# $NetBSD: monthly,v 1.4 1996/05/08 17:19:39 thorpej Exp $
|
||||
# $NetBSD: monthly,v 1.5 1997/01/05 11:21:11 mrg Exp $
|
||||
# @(#)monthly 5.5 (Berkeley) 6/17/91
|
||||
#
|
||||
|
||||
host=`hostname -s`
|
||||
echo "Subject: $host monthly run output"
|
||||
|
||||
umask 077
|
||||
|
||||
if [ -s /etc/monthly.conf ]; then
|
||||
. /etc/monthly.conf
|
||||
fi
|
||||
|
||||
# echo ""
|
||||
# echo "Doing login accounting:"
|
||||
# ac -p | sort -nr +1
|
||||
|
||||
# Rotation of these logs now handled automatically by cron and 'newsyslog':
|
||||
# kerberos.log
|
||||
# lpd-errs
|
||||
# wtmp
|
||||
# aculog
|
||||
# cron
|
||||
|
||||
echo "Nothing to do!"
|
||||
#echo "."
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# $NetBSD: monthly.conf,v 1.1 1997/01/05 11:21:12 mrg Exp $
|
||||
#
|
||||
# see monthly.conf(5) for more information.
|
||||
|
14
etc/weekly
14
etc/weekly
|
@ -1,15 +1,21 @@
|
|||
#!/bin/sh -
|
||||
#
|
||||
# $NetBSD: weekly,v 1.5 1996/05/08 17:19:49 thorpej Exp $
|
||||
# $NetBSD: weekly,v 1.6 1997/01/05 11:21:10 mrg Exp $
|
||||
# @(#)weekly 5.14 (Berkeley) 6/23/91
|
||||
#
|
||||
|
||||
PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec
|
||||
export PATH
|
||||
|
||||
umask 077
|
||||
|
||||
host=`hostname -s`
|
||||
echo "Subject: $host weekly run output"
|
||||
|
||||
if [ -s /etc/weekly.conf ]; then
|
||||
. /etc/weekly.conf
|
||||
fi
|
||||
|
||||
#echo ""
|
||||
#echo "Removing old .o files:"
|
||||
#find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \;
|
||||
|
@ -37,17 +43,15 @@ echo "Subject: $host weekly run output"
|
|||
# rm -rf $TDIR
|
||||
#fi
|
||||
|
||||
if [ -f /usr/lib/uucp/clean.weekly ]; then
|
||||
if [ X"$clean_uucp" != XNO -a -f /usr/lib/uucp/clean.weekly ]; then
|
||||
echo ""
|
||||
echo "Cleaning up UUCP:"
|
||||
echo /usr/lib/uucp/clean.weekly | su daemon
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Rotation of message log now handled automatically by cron and 'newsyslog'
|
||||
|
||||
echo ""
|
||||
if [ -f /var/db/locate.database ]; then
|
||||
if [ X"$rebuild_locatedb" != XNO -a -f /var/db/locate.database ]; then
|
||||
echo "Rebuilding locate database:"
|
||||
chmod 644 /var/db/locate.database
|
||||
chown nobody.nobody /var/db/locate.database
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# $NetBSD: weekly.conf,v 1.1 1997/01/05 11:21:11 mrg Exp $
|
||||
#
|
||||
# see weekly.conf(5) for more information.
|
||||
|
||||
clean_uucp=YES
|
||||
rebuild_locatedb=YES
|
Loading…
Reference in New Issue