summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1997-08-12 17:51:16 +0000
committerpst <pst@FreeBSD.org>1997-08-12 17:51:16 +0000
commita671e01be714c1ad4bb6ded5645a98beb2559803 (patch)
tree923ff330592016ec1aa7363bde74fcd64615bb09 /etc
parent3c7e85f93caec6a560489e4839cc2751332f39c7 (diff)
downloadFreeBSD-src-a671e01be714c1ad4bb6ded5645a98beb2559803.zip
FreeBSD-src-a671e01be714c1ad4bb6ded5645a98beb2559803.tar.gz
Initial import of the replacements for /etc/{daily, weekly, monthly}.
Please note: I'm not activating this until I successfully get the changes back into my local CVS repository to do one final check. Early adopters are welcome to send comments.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/cron.d/daily/100.clean-disks15
-rwxr-xr-xetc/cron.d/daily/110.clean-tmps32
-rwxr-xr-xetc/cron.d/daily/120.clean-preserve10
-rwxr-xr-xetc/cron.d/daily/130.clean-msgs11
-rwxr-xr-xetc/cron.d/daily/140.clean-rwho11
-rwxr-xr-xetc/cron.d/daily/200.backup-passwd35
-rwxr-xr-xetc/cron.d/daily/210.backup-aliases22
-rwxr-xr-xetc/cron.d/daily/220.backup-distfile15
-rwxr-xr-xetc/cron.d/daily/300.calendar17
-rwxr-xr-xetc/cron.d/daily/310.accounting15
-rwxr-xr-xetc/cron.d/daily/320.rdist10
-rwxr-xr-xetc/cron.d/daily/330.news11
-rwxr-xr-xetc/cron.d/daily/340.uucp13
-rwxr-xr-xetc/cron.d/daily/400.status-disks14
-rwxr-xr-xetc/cron.d/daily/410.status-uucp10
-rwxr-xr-xetc/cron.d/daily/420.status-network10
-rwxr-xr-xetc/cron.d/daily/430.status-rwho10
-rwxr-xr-xetc/cron.d/daily/440.status-mailq10
-rwxr-xr-xetc/cron.d/daily/450.status-security11
-rwxr-xr-xetc/cron.d/daily/999.local13
-rwxr-xr-xetc/cron.d/monthly/200.accounting11
-rwxr-xr-xetc/cron.d/monthly/999.monthly.local10
-rwxr-xr-xetc/cron.d/weekly/100.clean-src42
-rwxr-xr-xetc/cron.d/weekly/120.clean-kvmdb15
-rwxr-xr-xetc/cron.d/weekly/300.uucp12
-rwxr-xr-xetc/cron.d/weekly/310.locate18
-rwxr-xr-xetc/cron.d/weekly/320.whatis18
-rwxr-xr-xetc/cron.d/weekly/330.catman12
-rwxr-xr-xetc/cron.d/weekly/999.local10
29 files changed, 443 insertions, 0 deletions
diff --git a/etc/cron.d/daily/100.clean-disks b/etc/cron.d/daily/100.clean-disks
new file mode 100755
index 0000000..63b908e
--- /dev/null
+++ b/etc/cron.d/daily/100.clean-disks
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# $Id$
+#
+# 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.
+#
+
+exit 0 # do not run by default
+
+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 -- {} \;
diff --git a/etc/cron.d/daily/110.clean-tmps b/etc/cron.d/daily/110.clean-tmps
new file mode 100755
index 0000000..f997b7a
--- /dev/null
+++ b/etc/cron.d/daily/110.clean-tmps
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# $Id$
+#
+# 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.
+#
+# 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.
+#
+
+exit 0 # do not run by default
+
+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
diff --git a/etc/cron.d/daily/120.clean-preserve b/etc/cron.d/daily/120.clean-preserve
new file mode 100755
index 0000000..c2d5c65
--- /dev/null
+++ b/etc/cron.d/daily/120.clean-preserve
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+if [ -d /var/preserve ]; then
+ echo ""
+ echo "Removing stale files from /var/preserve:"
+ cd /var/preserve && find . ! -name . -mtime +7 -exec rm -f -- {} \;
+fi
diff --git a/etc/cron.d/daily/130.clean-msgs b/etc/cron.d/daily/130.clean-msgs
new file mode 100755
index 0000000..d5de981
--- /dev/null
+++ b/etc/cron.d/daily/130.clean-msgs
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $Id$
+#
+# remove system messages older than 21 days
+#
+if [ -d /var/msgs ] ; then
+ echo
+ echo "Cleaning out old system announcements:"
+ msgs -c
+fi
diff --git a/etc/cron.d/daily/140.clean-rwho b/etc/cron.d/daily/140.clean-rwho
new file mode 100755
index 0000000..6d7de56
--- /dev/null
+++ b/etc/cron.d/daily/140.clean-rwho
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+if [ -d /var/rwho ] ; then
+ echo ""
+ echo "Removing stale files from /var/rwho"
+ cd /var/rwho && find . ! -name . -mtime +7 -exec rm -f -- {} \;
+fi
+
diff --git a/etc/cron.d/daily/200.backup-passwd b/etc/cron.d/daily/200.backup-passwd
new file mode 100755
index 0000000..32664f8
--- /dev/null
+++ b/etc/cron.d/daily/200.backup-passwd
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# $Id$
+#
+bak=/var/backups
+
+if [ -f /etc/master.passwd -o -f /etc/group ] ; then
+ 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
+fi
diff --git a/etc/cron.d/daily/210.backup-aliases b/etc/cron.d/daily/210.backup-aliases
new file mode 100755
index 0000000..25388f8
--- /dev/null
+++ b/etc/cron.d/daily/210.backup-aliases
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# $Id$
+#
+bak=/var/backups
+
+if [ -f /etc/aliases ] ; then
+ echo ""
+ echo "Backing up mail aliases:"
+
+ 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
+fi
diff --git a/etc/cron.d/daily/220.backup-distfile b/etc/cron.d/daily/220.backup-distfile
new file mode 100755
index 0000000..96a5c05
--- /dev/null
+++ b/etc/cron.d/daily/220.backup-distfile
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# $Id$
+#
+bak=/var/backups
+
+if [ -f /etc/Distfile ]; then
+ echo ""
+ echo "Backing up /etc/Distfile"
+
+ 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
diff --git a/etc/cron.d/daily/300.calendar b/etc/cron.d/daily/300.calendar
new file mode 100755
index 0000000..876d25f
--- /dev/null
+++ b/etc/cron.d/daily/300.calendar
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# $Id$
+#
+# `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.
+#
+
+exit 0 # do not run by default
+
+if [ -f /usr/bin/calendar ] ; then
+ echo ""
+ echo "Running calendar:"
+ calendar -a
+fi
diff --git a/etc/cron.d/daily/310.accounting b/etc/cron.d/daily/310.accounting
new file mode 100755
index 0000000..e266548
--- /dev/null
+++ b/etc/cron.d/daily/310.accounting
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+if [ -f /var/account/acct ] ; then
+ echo ""
+ echo "Rotating accounting logs and gathering 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
diff --git a/etc/cron.d/daily/320.rdist b/etc/cron.d/daily/320.rdist
new file mode 100755
index 0000000..84958f1
--- /dev/null
+++ b/etc/cron.d/daily/320.rdist
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+if [ -f /etc/Distfile ]; then
+ echo ""
+ echo "Running rdist with /etc/Distfile:"
+ rdist -f /etc/Distfile
+fi
diff --git a/etc/cron.d/daily/330.news b/etc/cron.d/daily/330.news
new file mode 100755
index 0000000..3316fa3
--- /dev/null
+++ b/etc/cron.d/daily/330.news
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $Id$
+#
+# Expire news articles
+# (This is present only for backwards compatibility, usually the news
+# system handles this on its own).
+
+if [ -f /etc/news.expire ]; then
+ /etc/news.expire
+fi
diff --git a/etc/cron.d/daily/340.uucp b/etc/cron.d/daily/340.uucp
new file mode 100755
index 0000000..e26c585
--- /dev/null
+++ b/etc/cron.d/daily/340.uucp
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# $Id$
+#
+# Local cleanup of UUCP files. This is for backwards compatibility,
+# /etc/uuclean.daily doesn't exist by default.
+#
+if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then
+ echo ""
+ echo "Cleaning up UUCP:"
+ echo /etc/uuclean.daily | su daemon
+fi
+
diff --git a/etc/cron.d/daily/400.status-disks b/etc/cron.d/daily/400.status-disks
new file mode 100755
index 0000000..c92e62a
--- /dev/null
+++ b/etc/cron.d/daily/400.status-disks
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+echo ""
+echo "Disk status:"
+
+df -k -t nonfs
+
+# display which filesystems need backing up
+
+echo ""
+dump W
diff --git a/etc/cron.d/daily/410.status-uucp b/etc/cron.d/daily/410.status-uucp
new file mode 100755
index 0000000..6a0840e
--- /dev/null
+++ b/etc/cron.d/daily/410.status-uucp
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+if [ -d /var/spool/uucp -a -x /usr/bin/uustat ]; then
+ echo ""
+ echo "uucp status:"
+ uustat -a
+fi
diff --git a/etc/cron.d/daily/420.status-network b/etc/cron.d/daily/420.status-network
new file mode 100755
index 0000000..79dcfd2
--- /dev/null
+++ b/etc/cron.d/daily/420.status-network
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+if [ -x /usr/bin/netstat ] ; then
+ echo ""
+ echo "Network interface status:"
+ netstat -i
+fi
diff --git a/etc/cron.d/daily/430.status-rwho b/etc/cron.d/daily/430.status-rwho
new file mode 100755
index 0000000..c8f2632
--- /dev/null
+++ b/etc/cron.d/daily/430.status-rwho
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+if [ -d /var/rwho -a -x /usr/bin/rwho ] ; then
+ echo ""
+ echo "Local network system status:"
+ ruptime
+fi
diff --git a/etc/cron.d/daily/440.status-mailq b/etc/cron.d/daily/440.status-mailq
new file mode 100755
index 0000000..03ff746
--- /dev/null
+++ b/etc/cron.d/daily/440.status-mailq
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# $Id$
+#
+if [ -x /usr/sbin/mailq -a -d /var/spool/mqueue ] ; then
+ echo ""
+ echo "Mail in local queue:"
+
+ mailq
+fi
diff --git a/etc/cron.d/daily/450.status-security b/etc/cron.d/daily/450.status-security
new file mode 100755
index 0000000..a5fcb42
--- /dev/null
+++ b/etc/cron.d/daily/450.status-security
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $Id$
+#
+
+if [ -f /etc/security -a -x /usr/sbin/sendmail ] ; then
+ echo ""
+ echo "Security check (output mailed separately)"
+
+ sh /etc/security 2>&1 | sendmail root
+fi
diff --git a/etc/cron.d/daily/999.local b/etc/cron.d/daily/999.local
new file mode 100755
index 0000000..f527b99
--- /dev/null
+++ b/etc/cron.d/daily/999.local
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# $Id$
+#
+# Run the old /etc/daily.local script. This is really for backwards
+# compatibility more than anything else.
+#
+if [ -f /etc/daily.local ]; then
+ echo ""
+ echo "Running daily.local:"
+
+ sh /etc/daily.local
+fi
diff --git a/etc/cron.d/monthly/200.accounting b/etc/cron.d/monthly/200.accounting
new file mode 100755
index 0000000..3ecd8cb
--- /dev/null
+++ b/etc/cron.d/monthly/200.accounting
@@ -0,0 +1,11 @@
+#!/bin/sh -
+#
+# $Id$
+#
+
+if [ -x /usr/sbin/ac ] ; then
+ echo ""
+ echo "Doing login accounting:"
+
+ ac -p | sort -nr +1
+fi
diff --git a/etc/cron.d/monthly/999.monthly.local b/etc/cron.d/monthly/999.monthly.local
new file mode 100755
index 0000000..ce7ed0c
--- /dev/null
+++ b/etc/cron.d/monthly/999.monthly.local
@@ -0,0 +1,10 @@
+#!/bin/sh -
+#
+# $Id$
+#
+if [ -f /etc/monthly.local ]; then
+ echo ""
+ echo "Running monthly.local:"
+
+ sh /etc/monthly.local
+fi
diff --git a/etc/cron.d/weekly/100.clean-src b/etc/cron.d/weekly/100.clean-src
new file mode 100755
index 0000000..87eafa5
--- /dev/null
+++ b/etc/cron.d/weekly/100.clean-src
@@ -0,0 +1,42 @@
+#!/bin/sh -
+#
+# $Id$
+#
+# Clean up /usr/src
+#
+# This really hasn't been used in generations, it's just here for
+# backwards compatibility -- we don't even use SCCS anymore
+#
+
+exit 0 # do not run by default
+
+# see if /usr/src exists and is local before doing anything
+
+if [ -d /usr/src -a \
+ X"`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" != X ];
+then
+
+ echo ""
+ echo "Removing old .o files from /usr/src:"
+
+ find /usr/src -name '*.o' -atime +21 -print -a -exec rm -f {} \;
+
+ echo "looking for checked out files in /usr/src:"
+ 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
diff --git a/etc/cron.d/weekly/120.clean-kvmdb b/etc/cron.d/weekly/120.clean-kvmdb
new file mode 100755
index 0000000..a78817e
--- /dev/null
+++ b/etc/cron.d/weekly/120.clean-kvmdb
@@ -0,0 +1,15 @@
+#!/bin/sh -
+#
+# $Id$
+#
+
+if [ -d /var/db -a -x /usr/sbin/sysctl ] ; then
+ 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 -- {} \;
+fi
diff --git a/etc/cron.d/weekly/300.uucp b/etc/cron.d/weekly/300.uucp
new file mode 100755
index 0000000..5d8c3f9
--- /dev/null
+++ b/etc/cron.d/weekly/300.uucp
@@ -0,0 +1,12 @@
+#!/bin/sh -
+#
+# $Id$
+#
+# This is really here for backwards compatibility, clean.weekly is not
+# created by default anymore.
+
+if [ -d /var/spool/uucp -a -f /usr/libexec/uucp/clean.weekly ]; then
+ echo ""
+ echo "Cleaning up UUCP:"
+ echo /usr/libexec/uucp/clean.weekly | su daemon
+fi
diff --git a/etc/cron.d/weekly/310.locate b/etc/cron.d/weekly/310.locate
new file mode 100755
index 0000000..85c2bc2
--- /dev/null
+++ b/etc/cron.d/weekly/310.locate
@@ -0,0 +1,18 @@
+#!/bin/sh -
+#
+# $Id$
+#
+locdb=/var/db/locate.database
+
+if [ -x /usr/libexec/locate.updatedb -a -f $locdb ] ; then
+
+ echo ""
+ echo "Rebuilding 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}
+fi
diff --git a/etc/cron.d/weekly/320.whatis b/etc/cron.d/weekly/320.whatis
new file mode 100755
index 0000000..8767461
--- /dev/null
+++ b/etc/cron.d/weekly/320.whatis
@@ -0,0 +1,18 @@
+#!/bin/sh -
+#
+# $Id$
+#
+
+if [ -x /usr/libexec/makewhatis.local -a -d /usr/share/man ] ; then
+
+ 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
+
+ /usr/libexec/makewhatis.local "${MANPATH}"
+fi
diff --git a/etc/cron.d/weekly/330.catman b/etc/cron.d/weekly/330.catman
new file mode 100755
index 0000000..99d1d27
--- /dev/null
+++ b/etc/cron.d/weekly/330.catman
@@ -0,0 +1,12 @@
+#!/bin/sh -
+#
+# $Id$
+#
+
+exit 0 # do not run by default
+
+if [ -x /usr/libexec/catman.local -a -d /usr/share/man/cat1 ] ; then
+ echo ""
+ echo "Reformatting manual pages:"
+ echo /usr/libexec/catman.local "${MANPATH}" | su -fm man
+fi
diff --git a/etc/cron.d/weekly/999.local b/etc/cron.d/weekly/999.local
new file mode 100755
index 0000000..70bffb6
--- /dev/null
+++ b/etc/cron.d/weekly/999.local
@@ -0,0 +1,10 @@
+#!/bin/sh -
+#
+# $Id$
+#
+
+if [ -f /etc/weekly.local ]; then
+ echo ""
+ echo "Running weekly.local:"
+ sh /etc/weekly.local
+fi
OpenPOWER on IntegriCloud