Crontab problem - multiple entries


#1

Hello,

I’m trying to setup some additional statistics services that will be better than the cryptic analog pages. I’m deciding between awstats and webalizer. For the time being, I’m trying both out for a while, and as such would like to figure out how to setup crontab to run both every couple of hours. It’s a small site, so each process only runs for a second or two.

In my crontab file, I have two lines,

0 * * * * /usr/bin/perl /home/username/awstats/cgi-bin/awstats_updateall.pl now >> /home/username/awstats.log
0 * * * * /home/username/webalizer/webalizer -c /home/username/webalizer/webalizer.conf >> /home/username/webalizer.log

Instead of using pico to enter the information (crontab -e), I placed those two lines in a text file and did ‘crontab file.txt’. Doing a ‘crontab -l’ verifies that the two entries appear in the list.

However, when the process runs, only the first process (awstats) gets executed, and the second one (webalizer) is not run. I receive no errors in the log output file I have created. To test, I swapped the two lines, and upon the next crontab execution, webalizer ran but awstats did not.

I read through the crontab page on the wiki, and didn’t see if there was a restriction to running only a single process, but perhaps this is the case?

I’d appreciate any advice on what I should do. Thanks!

  • William

#2

Are any errors emailed to the username you’re running this as?

using /some/cron/job >> /some/log.file
just sends stdout to the logfile

You could do:
/some/cron/job >> /some/log.file 2>&1

to redirect both stdout and stderr.


#3

No, I don’t receive any errors whatsoever… I’ll try adding in the other part of the command to get any errors and see what happens when 5pm rolls along.

I don’t think there will be any errors because when I run the commands exactly as I have in the crontab file, both commands execute beautifully.

Thanks for your help.

UPDATE: Upon the crontab scheduler running again at 5pm EST, it only ran the first command (awstats) and not the second (webalizer). The two lines are now as follows:

0 * * * * /usr/bin/perl /home/username/awstats/cgi-bin/awstats_updateall.pl now >> /home/username/awstats.log 2>&1
0 * * * * /home/username/webalizer/webalizer -c /home/username/webalizer/webalizer.conf >> /home/username/webalizer.log 2>&1


#4

When you type your two lines into your text file have you added a blank line at the end before saving it?

Or try the crontabs with a minute or two difference.


Norm


#5

Hi Norm,

I tried separating them by a few minutes, with no luck. I did add a blank line at the end of the text file, and that seemed to fix everything! I’m not certain what a blank line does, but I know none of the stuff I googled mentioned that.

I appreciate the help, and have a good weekend!


#6

I tend to add a blank line at the ned of text files as it can cure some ills.
I was told why once. I think it has to do with the way carriage returns and newlines are either added together or singly in different OSs’. I think my brain cell carrying that data may have become extinct!


Norm