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

Crontab, Scripting and Syslog



Hi folks
On my webserver I've recently added a log-sorting and presentation
program by the name of Webalizer. To make it run, I've put this line in
the crontab (everything runs as a normal user):

* 04 * * * /home/titanus/scripts/web-log >> /dev/null 2>&1

The line runs every morning at 4, and AFAIK, the /dev/-part should
redirect all but errors to null.

The script is really simple:

#!/bin/sh
webalizer=/usr/bin/webalizer
yesterday_date=$(date -d yesterday +%Y.%m.%d)

# For debugging
# echo "$webalizer"
# echo "$yesterday_date"

if test -e /var/log/apache2/access.$yesterday_date; then
   $webalizer /var/log/apache2/access.$yesterday_date
   else
   echo "Yesterdays log not found. Exiting"
   exit 12
fi

exit 0

Now, my question is these lines in syslog:

titanus@aptget:~$ sudo cat /var/log/syslog | grep titanus
Jun 11 04:00:01 aptget /USR/SBIN/CRON[1567]: (titanus) CMD
(/home/titanus/scripts/web-log >> /dev/null 2>&1)
Jun 11 04:01:01 aptget /USR/SBIN/CRON[1572]: (titanus) CMD
(/home/titanus/scripts/web-log >> /dev/null 2>&1)

(One line per minut for an entire hour)

Jun 11 04:59:01 aptget /USR/SBIN/CRON[1879]: (titanus) CMD
(/home/titanus/scripts/web-log >> /dev/null 2>&1)

What do they mean?
As far as I can see, the result of Webalizer is made at 4, not 4:59, so
I suspect the srcipt only runs at 4. The system is a standard Squeeze
with nothing funny or unstable.

Thanks, tit


Reply to: