Cron execution

Hi, I’m fairly new to the cron job thing, and so I’m hoping that I’ve got a problem that someone will be able to fix fairly easily.

I installed Awstats, and have it all set up and running fine, but I can’t seem to get my cron job to run.

In the shell if I type crontab -l I get the following:

0 3 * * * perl /home//awstats/tools/ -config= -update -awstatsprog=/home//awstats/cgi-bin/ -dir=/home///statistics/

Which suggests to me that it is set up ok. BTW, if I just run the command it executes fine and updates my stats. If I’ve done it right, that should execute at 3am every morning, which is the default from the Wiki guide.

My question is, can anyone suggest why my cron job isn’t running? And do I need to register my cron job with the daemon or anything in order to get it running? I was under the impression that the server’s daemon automatically checked all users cron jobs once ever minute.

Most likely - Include the full path to perl, probably /usr/bin/perl

Thanks Tor, I think you’re right. I’ve made the changes and I’m going to Schedule it to run soon and see what happens.

Well, I changed the cron job and set it to run at 8:50 after checking the time on the server, and it didn’t execute again for some reason.

this is what I now have… again it runs if I just run the command:

50 08 * * * /usr/local/bin/perl /home//awstats/tools/ -config= -update -awstatsprog=/home//awstats/cgi-bin/ -dir=/home///statistics/

Anyone any ideas?

I had this very problem once, and it turned out I had a carriage return somewhere in the command, at a place where it wasn’t obvious just by looking at the screen. I can’t for the life of me imagine why it would’ve run when I copied and pasted it and ran it directly–I would think it would have been broken there, too-- but it did. I was scratching my head over that one for a while.


I don’t know if this will be helpful but I want to suggest it, because I know how frustrating the initial problems were for me.

I had to configure puTTY and my editor (nano) to disable line wrapping, and still had to wrangle with the cron entry to make sure there was no wrapping. I also needed a blankline at the the bottom of my cron edit.

Wrapping seems like a common pitfall considering the wiki entry got this redundant about mentioning it:

[quote]Insert the following

If the line is too large in the default editor than it will fall to the next line, you will have to manually go back and press delete to make sure it is all on the same line. It all must be on the same line.
As always, change the yourusername and to your information.
The following has been moved to two lines to save from side scrolling, it still needs to be one line. [/quote]

Thanks for the suggestions Daisy and Pangea. I’ll have to look more closely at it.

I’m not sure exactly what it was, but I made sure there were no carriage returns in it, and added a blank line to the bottom, and hey presto it’s away and running. Thanks for all your help everyone.