mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-01 08:27:59 +00:00
Make the cutover to periodic and cron.d as discussed to death on committers
for the past week.
This commit is contained in:
parent
fb1485d3e3
commit
00496c2855
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28144
12
etc/crontab
12
etc/crontab
@ -1,6 +1,6 @@
|
||||
# /etc/crontab - root's crontab for FreeBSD
|
||||
#
|
||||
# $Id$
|
||||
# $Id: crontab,v 1.16 1997/02/23 09:20:40 peter Exp $
|
||||
#
|
||||
SHELL=/bin/sh
|
||||
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
|
||||
@ -11,14 +11,14 @@ HOME=/var/log
|
||||
*/5 * * * * root /usr/libexec/atrun
|
||||
#
|
||||
# rotate log files every hour, if necessary
|
||||
0 * * * * root /usr/sbin/newsyslog
|
||||
0 * * * * root newsyslog
|
||||
#
|
||||
# do daily/weekly/monthly maintenance
|
||||
0 2 * * * root /etc/daily 2>&1 | sendmail root
|
||||
30 3 * * 6 root /etc/weekly 2>&1 | sendmail root
|
||||
30 5 1 * * root /etc/monthly 2>&1 | sendmail root
|
||||
0 2 * * * root periodic daily 2>&1 | sendmail root
|
||||
30 3 * * 6 root periodic weekly 2>&1 | sendmail root
|
||||
30 5 1 * * root periodic monthly 2>&1 | sendmail root
|
||||
#
|
||||
# time zone change adjustment for wall cmos clock,
|
||||
# does nothing, if you have UTC cmos clock.
|
||||
# See adjkerntz(8) for details.
|
||||
1,31 0-4 * * * root /sbin/adjkerntz -a
|
||||
1,31 0-4 * * * root adjkerntz -a
|
||||
|
173
etc/daily
173
etc/daily
@ -1,173 +0,0 @@
|
||||
#!/bin/sh -
|
||||
#
|
||||
# @(#)daily 5.12 (Berkeley) 5/24/91
|
||||
#
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
host=`hostname -s`
|
||||
echo "Subject: $host daily run output"
|
||||
bak=/var/backups
|
||||
|
||||
echo ""
|
||||
echo "Removing scratch and junk files:"
|
||||
if [ -d /var/preserve ]; then
|
||||
cd /var/preserve && {
|
||||
find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
|
||||
fi
|
||||
|
||||
if [ -d /var/rwho ] ; then
|
||||
cd /var/rwho && {
|
||||
find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
|
||||
fi
|
||||
|
||||
cd /tmp
|
||||
|
||||
# This is a security hole, never use 'find' on a public directory
|
||||
# with -exec rm -f as root. This can be exploited to delete any file
|
||||
# on the system.
|
||||
#
|
||||
#find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \
|
||||
# \( -name '[#,]*' -o -name '.#*' -o -name a.out -o -name '*.core' \
|
||||
# -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \
|
||||
# -a -atime +3 -exec rm -f -- {} \;
|
||||
#
|
||||
#
|
||||
# The same security hole. Purge the temp directories from unused stuff.
|
||||
# Note that we must not accidentally clean the X11 lock files.
|
||||
#
|
||||
# Use at your own risk, but for a long-living system, this might come
|
||||
# more useful than the boot-time cleaning of /tmp. If /var/tmp and
|
||||
# /tmp are symlinked together, only one of the below will actually
|
||||
# run.
|
||||
#
|
||||
# if [ -d /tmp ]; then
|
||||
# cd /tmp && {
|
||||
# find . -type f -atime +3 -ctime +3 ! -name '.X*-lock' -exec rm -f -- {} \;
|
||||
# find -d . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
|
||||
# >/dev/null 2>&1; }
|
||||
# fi
|
||||
#
|
||||
# if [ -d /var/tmp ]; then
|
||||
# cd /var/tmp && {
|
||||
# find . ! -name . -atime +7 -ctime +3 -exec rm -f -- {} \;
|
||||
# find -d . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
|
||||
# >/dev/null 2>&1; }
|
||||
# fi
|
||||
#
|
||||
#
|
||||
|
||||
# remove system messages older than 21 days
|
||||
msgs -c
|
||||
|
||||
if [ -f /etc/news.expire ]; then
|
||||
/etc/news.expire
|
||||
fi
|
||||
|
||||
if [ -f /var/account/acct ] ; then
|
||||
echo ""
|
||||
echo "Gathering accounting statistics:"
|
||||
cd /var/account
|
||||
if [ -f acct.2 ] ; then mv -f acct.2 acct.3 ; fi
|
||||
if [ -f acct.1 ] ; then mv -f acct.1 acct.2 ; fi
|
||||
if [ -f acct.0 ] ; then mv -f acct.0 acct.1 ; fi
|
||||
cp -pf acct acct.0
|
||||
sa -s > /dev/null
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Backup passwd and group files:"
|
||||
if [ ! -f $bak/master.passwd.bak ] ; then
|
||||
echo "no $bak/master.passwd.bak"
|
||||
cp -p /etc/master.passwd $bak/master.passwd.bak
|
||||
fi
|
||||
if cmp -s $bak/master.passwd.bak /etc/master.passwd; then :; else
|
||||
echo "$host passwd diffs:"
|
||||
diff $bak/master.passwd.bak /etc/master.passwd |\
|
||||
sed 's/^\([<>] [^:]*\):[^:]*:/\1:(password):/'
|
||||
mv $bak/master.passwd.bak $bak/master.passwd.bak2
|
||||
cp -p /etc/master.passwd $bak/master.passwd.bak
|
||||
fi
|
||||
if [ ! -f $bak/group.bak ] ; then
|
||||
echo "no $bak/group.bak"
|
||||
cp -p /etc/group $bak/group.bak
|
||||
fi
|
||||
if cmp -s $bak/group.bak /etc/group; then :; else
|
||||
echo "$host group diffs:"
|
||||
diff $bak/group.bak /etc/group
|
||||
mv $bak/group.bak $bak/group.bak2
|
||||
cp -p /etc/group $bak/group.bak
|
||||
fi
|
||||
if [ ! -f $bak/aliases.bak ] ; then
|
||||
echo "no $bak/aliases.bak"
|
||||
cp -p /etc/aliases $bak/aliases.bak
|
||||
fi
|
||||
if cmp -s $bak/aliases.bak /etc/aliases; then :; else
|
||||
echo "$host aliases diffs:"
|
||||
diff $bak/aliases.bak /etc/aliases
|
||||
mv $bak/aliases.bak $bak/aliases.bak2
|
||||
cp -p /etc/aliases $bak/aliases.bak
|
||||
fi
|
||||
if [ -f /etc/Distfile ]; then
|
||||
if cmp -s $bak/Distfile.bak /etc/Distfile; then :; else
|
||||
mv $bak/Distfile.bak $bak/Distfile.bak2
|
||||
cp /etc/Distfile $bak/Distfile.bak
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# `calendar -a' needs to die. Why? Because it's a bad idea, particular
|
||||
# with networked home directories, but also in general. If you want the
|
||||
# output of `calendar' mailed to you, set up a cron job to do it,
|
||||
# or run it from your ~/.profile or ~/.login.
|
||||
#
|
||||
# echo ""
|
||||
# echo "Running calendar:"
|
||||
# calendar -a
|
||||
|
||||
|
||||
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 -t local
|
||||
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 ""
|
||||
if [ -d /var/rwho ] ; then
|
||||
ruptime
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if [ -f /etc/Distfile ]; then
|
||||
echo "Running rdist:"
|
||||
rdist -f /etc/Distfile
|
||||
fi
|
||||
|
||||
if [ -f /etc/daily.local ]; then
|
||||
echo "Running daily.local:"
|
||||
sh /etc/daily.local
|
||||
fi
|
||||
|
||||
sh /etc/security 2>&1 | sendmail root
|
18
etc/monthly
18
etc/monthly
@ -1,18 +0,0 @@
|
||||
#!/bin/sh -
|
||||
#
|
||||
# @(#)monthly 5.5 (Berkeley) 6/17/91
|
||||
#
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
host=`hostname -s`
|
||||
echo "Subject: $host monthly run output"
|
||||
|
||||
echo ""
|
||||
echo "Doing login accounting:"
|
||||
ac -p | sort -nr +1
|
||||
|
||||
if [ -f /etc/monthly.local ]; then
|
||||
echo ""
|
||||
echo "Running monthly.local:"
|
||||
sh /etc/monthly.local
|
||||
fi
|
78
etc/weekly
78
etc/weekly
@ -1,78 +0,0 @@
|
||||
#!/bin/sh -
|
||||
#
|
||||
# @(#)weekly 5.14 (Berkeley) 6/23/91
|
||||
# $Id: weekly,v 1.19 1997/02/23 09:20:55 peter Exp $
|
||||
|
||||
PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec
|
||||
export PATH
|
||||
|
||||
host=`hostname -s`
|
||||
echo "Subject: $host weekly run output"
|
||||
|
||||
#echo ""
|
||||
#echo "Removing old .o files:"
|
||||
#find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \;
|
||||
|
||||
# see if /usr/src exists and is local
|
||||
# before looking there for checked-out files
|
||||
|
||||
#if [ -d /usr/src -a \
|
||||
# X"`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" != X ];
|
||||
#then
|
||||
# echo "looking for checked out files:"
|
||||
# TDIR=/tmp/_checkout$$
|
||||
#
|
||||
# mkdir $TDIR
|
||||
# for file in `find -f /usr/src ! -fstype local -prune -or \
|
||||
# -name 'p.*' -print | egrep 'SCCS/p\.'`; do
|
||||
# owner=`awk '{ print $3 }' $file`
|
||||
# echo "$owner $file"
|
||||
# echo $file >> $TDIR/$owner
|
||||
# done | sed -e 's,SCCS/p.,,'
|
||||
# for file in $TDIR/*; do
|
||||
# sed -e 's,SCCS/p.,,' $file | \
|
||||
# Mail -s 'checked out files' `basename $file`
|
||||
# done
|
||||
# rm -rf $TDIR
|
||||
#fi
|
||||
|
||||
if [ -f /usr/libexec/uucp/clean.weekly ]; then
|
||||
echo ""
|
||||
echo "Cleaning up UUCP:"
|
||||
echo /usr/libexec/uucp/clean.weekly | su daemon
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Rebuilding locate database:"
|
||||
locdb=/var/db/locate.database
|
||||
touch ${locdb}; chown nobody ${locdb}; chmod 644 ${locdb}
|
||||
echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody 2>&1 |\
|
||||
fgrep -v 'Permission denied'
|
||||
chmod 444 ${locdb}
|
||||
|
||||
echo ""
|
||||
echo "Rebuilding whatis database:"
|
||||
if [ -d /usr/X11R6/man ]
|
||||
then
|
||||
MANPATH=${MANPATH:-/usr/share/man:/usr/X11R6/man:/usr/local/man}
|
||||
else
|
||||
MANPATH=${MANPATH:-/usr/share/man:/usr/local/man}
|
||||
fi
|
||||
|
||||
makewhatis.local "${MANPATH}"
|
||||
|
||||
#echo ""
|
||||
#echo "Reformatting manual pages:"
|
||||
#echo catman.local "${MANPATH}" | su -fm man
|
||||
|
||||
echo ""
|
||||
echo "Cleaning up kernel database files:"
|
||||
kernel=`sysctl -n kern.bootfile`
|
||||
kernel=kvm_`basename ${kernel}`.db
|
||||
find /var/db -name "kvm_*.db" -a ! -name ${kernel} -a -atime +7 -exec rm -f -- {} \;
|
||||
|
||||
if [ -f /etc/weekly.local ]; then
|
||||
echo ""
|
||||
echo "Running weekly.local:"
|
||||
sh /etc/weekly.local
|
||||
fi
|
Loading…
Reference in New Issue
Block a user