0
I have set the crontab
like this:
*/5 0 * * * /www/permitChat.sh
and the /www/permitChat.sh
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.
Is your system time correct? – Justin Pearce – 2012-10-03T20:55:51.513
Yes. The
date
command displays: Thu Oct 4 02:31:13 IST 2012 – hjpotter92 – 2012-10-03T21:05:40.990It’s good that the
date
command works for you, but do you know whether the system (specifically, thecron
process) is running with the same time zone as you? – Scott – 2012-10-03T21:13:34.813@Scott How do I check that? – hjpotter92 – 2012-10-03T21:50:46.770
Umm... Put a
date
command (with output to somewhere you can see it, like a log file) into acron
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 – 2012-10-03T22:01:12.800I've added a
date >> ~/log.txt
to the script. Will put up the output here. – hjpotter92 – 2012-10-03T22:11:43.443