[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cron problem



Rick Macdonald wrote:
> 
> Lawrence Chim wrote:
> >
> > I don't know why cron always send mail to root with the following
> > body.  Any idea?
> >
> > Subject: Cron <root@ppp-1-145> run-parts /etc/cron.daily
> > X-Cron-Env: <SHELL=/bin/sh>
> > X-Cron-Env:
> > <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>
> > X-Cron-Env: <HOME=/root>
> > X-Cron-Env: <LOGNAME=root>
> >
> > getopt: illegal option -- o
> 
> You might want to post the file "/etc/cron.daily" so we can see
> what the problem is.

Here is the files in /etc/cron.daily.  Sorry if it is too many.

lawrence,
#! /bin/sh
#
# cron script to rotate process accounting file.
#
# Written by Ian A. Murdock <imurdock@gnu.ai.mit.edu>

cd /var/account
savelog -g adm -m 644 -u root -c 7 /var/account/pacct >/dev/null
accton 2>/dev/null
accton /var/account/pacct 2>/dev/null
#
# This is needed because accton.c returns errno
exit 0
#! /bin/sh
#
# apache	Rotate the apache logsfiles daily.
#

[ -d /var/log/apache/. ] || exit 0
umask 022

# Take care of the standard logfiles.
cd /var/log/apache
if [ -f access.log ]
then
  savelog -c 7 access.log > /dev/null
fi
if [ -f error.log ]
then
  savelog -c 7 error.log > /dev/null
fi

# Send a reload signal to the apache server.
if [ -f /var/run/apache/apache.pid ]
then
  kill -1 `cat /var/run/apache/apache.pid` 2>/dev/null
fi

#!/bin/sh
#
# This housekeeping shell script is installed as /etc/cron.daily/dwww.
# Cron automatically runs it once a day.
#
# This script re-builds the dwww web pages, and removes old documents
# from the cache that have not been accessed for some number of days.
# The number of days should be configured by setting the DWWW_KEEPDAYS
# variable in /etc/default/dwww.  The value set in this script is a
# default; don't modify it, or an upgrade will wipe out your modification.

DWWW_KEEPDAYS=10
DWWW_QUICKFIND_DB=/var/lib/dwww/quickfind.dat
if test -r /etc/dwww.conf
then
	. /etc/dwww.conf
fi

dwww-build --default >/dev/null
find /var/lib/dpkg/info -name '*.list' |
	dwww-quickfind --build $DWWW_QUICKFIND_DB.new
mv -f $DWWW_QUICKFIND_DB.new $DWWW_QUICKFIND_DB
find /var/spool/dwww -atime +$DWWW_KEEPDAYS -name '[^.]*' \
	-maxdepth 1 -type f -print0 | xargs -0 rm -f
dwww-cache --clean
#! /bin/sh
#
# cron script to update the `find.codes' database.
#
# Written by Ian A. Murdock <imurdock@debian.org>.

su nobody -c "cd / && updatedb" 2>/dev/null
#!/bin/sh
#
# $Id: cron.daily,v 1.4 1996/02/17 16:09:20 alvar Exp $
#

# expunge old catman pages which have not been read in a week
/usr/bin/nice find /var/catman -type f -name '*.gz' -atime +7 -print | xargs rm -f

# expunge old catman pages which are older than one month
/usr/bin/nice find /var/catman -type f -name '*.gz' -mtime +30 -print | xargs rm -f

exit 0
#!/bin/sh

cd /var/log/mgetty
for LOG in mg_*log; do
   if [ -f $LOG ]; then
      savelog -g adm -m 644 -u root -c 7 $LOG >/dev/null
   fi
done
#!/bin/sh
# /etc/cron.daily/net-acct: nacctd daily maintenance script
# 
# Created Thu Jul 18 21:41:26 MET DST 1996 Bernd Eckenfels <ecki@debian.org>
#
# See /usr/doc/net-acct/ for informations
#
test -d /var/log/net-acct || exit 0;
test -r /etc/naccttab     || exit 0;

cd /var/log/net-acct
umask 022

# Stop writing out entries
kill -TSTP `cat /var/run/nacctd.pid`

# cycle logfiles (keep the last 14)
savelog -g root -m 644 -u root -c 14 net-acct.log >/dev/null

# save the last debug file, for inforation only. nacctd never closes this
# file, dont delete.
# yes, here is a race, but we dont need that data, anyway
cp net-acct.debug net-acct.debug.0
date > net-acct.debug

# Start writing out entries again
kill -CONT `cat /var/run/nacctd.pid`

exit 0
#!/bin/sh
# /etc/cron.daily/netbase: netbase daily maintenance script
# Written by Peter Tobias <tobias@linux.de>

bak=/var/backups

umask 022
if cd $bak
then
	cmp -s inetd.conf.bak /etc/inetd.conf || cp -p /etc/inetd.conf inetd.conf.bak
fi

#!/bin/sh

if [ -f /var/log/ppp.log ]; then
	savelog -g adm -m 644 -u root -c 4 /var/log/ppp.log >/dev/null
	/etc/init.d/sysklogd reload
fi
#!/bin/sh
# Run the Smail error checking script and rotate the logfiles.
# We have to rotate the logs as root as otherwise we can't fix the
# timestamps, and so we might as well add the checkerr script here
# too.
test -f /usr/sbin/smail || exit 0
cd /tmp
su mail -c /usr/lib/smail/checkerr

set -e
cd /var/log/smail
savelog -o root -g mail -m 644 -c 7 logfile paniclog >/dev/null
#!/bin/sh
# /etc/cron.daily/standard: standard daily maintenance script
# Written by Ian A. Murdock <imurdock@gnu.ai.mit.edu>
# Modified by Ian Jackson <ijackson@nyx.cs.du.edu>
# Modified by Steve Greenland <stevegr@master.debian.org>

bak=/var/backups

# The following three find commands are commented out do to the
# severe, easily exploited security hole introduced by 'find . _stuff_
# | xargs rm' style commands. Changing it to '-exec rm {}' doesn't
# help. If you need a program to prune back your tmp directories, try
# filereaper, also a Debian package.

# if [ -d /tmp -a ! -L /tmp ] && cd /tmp
# then
# 	find . -type f -atime +3 -print0 | xargs -r0 rm -f --
# 	find . ! -name . -type d -mtime +1 -print0 | xargs -r0 rmdir -- >/dev/null 2>&1
# fi

# if [ -d /var/tmp -a ! -L /var/tmp ] && cd /var/tmp
# then
# 	find . -type f -atime +7 -print0 | xargs -r0 rm -f --
# 	find . ! -name . -type d -mtime +1 -print0 | xargs -r0 rmdir -- >/dev/null 2>&1
# fi

#if cd /var/spool/cron/crontabs
#then
#	find . -name 'tmp.[0-9]*' -mtime +2 -print0 | xargs -r0 rm -f --
#fi

umask 022
if cd $bak
then
	cmp -s passwd.bak /etc/passwd || cp -p /etc/passwd passwd.bak
	cmp -s group.bak  /etc/group  || cp -p /etc/group  group.bak
fi

cd /var/lib/dpkg
if ! cmp -s status.yesterday.0 status
then
	cp -p status status.yesterday
	savelog -c 7 status.yesterday >/dev/null
fi

cd /var/log
umask 027
savelog -c 7 setuid.changes >/dev/null
checksecurity >setuid.changes

Reply to: