Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have set the crontab like this:

*/5 0 * * * /www/

and the /www/ is this:

# We are setting the name of file
# in the variable along with complete path.
sFilePath=`date +\/www\/ChatLogs\/%Y\/%m/%d_%m_%Y.txt`
# First we set its permissions to
# readable by all users, and then
# modify them to be writable by only root.
chmod a=r $sFilePath
chmod u+w $sFilePath
ls -lh $sFilePath

The trouble I am facing is, the cron gets executed after 12:00 PM everyday, instead of executing at 12:00 AM to 01:00 AM, every 5 minutes.

What could be wrong? All my system variables appear to be synced.

share|improve this question
Is your system time correct? – Justin Pearce Oct 3 '12 at 20:55
Yes. The date command displays: Thu Oct 4 02:31:13 IST 2012 – hjpotter92 Oct 3 '12 at 21:05
It’s good that the date command works for you, but do you know whether the system (specifically, the cron process) is running with the same time zone as you? – Scott Oct 3 '12 at 21:13
@Scott How do I check that? – hjpotter92 Oct 3 '12 at 21:50
Umm... Put a date command (with output to somewhere you can see it, like a log file) into a cron job. Make sure you aren’t sourcing your .profile or anything that would set up your environment. Also, there’s probably some config file you could look in, but even if I knew what OS you were using, I wouldn’t be able to tell you where it is without doing research that’s probably easier for you to do. – Scott Oct 3 '12 at 22:01

You must log in to answer this question.

Browse other questions tagged .