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

Re: Crontab, Scripting and Syslog



On Mon, Jul 02, 2012 at 02:51:06PM +0200, Titanus Eramius wrote:
> 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:
> 
[cut]
> 
> 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.

These lines are cron telling you what it's running. Note that your
crontab line states: 

# min hr dom mon dow command 
> *   04 *   *   *   /home/titanus/scripts/web-log >> /dev/null 2>&1

That is, every minute during hour 4, on every day of every month (that
being every day of the week), the command is run.

Presumably, webalizer writes its output to the same place each time, so
that is why you're only seeing the output of the 4:59 run.

Try changing your crontab to read:

# min hr dom mon dow command 
  0   04 *   *   *   /home/titanus/scripts/web-log >> /dev/null 2>&1

This will run at 4:00 every day, and is probably what you meant.

Attachment: signature.asc
Description: Digital signature


Reply to: