ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have setup a cron job as follows :
1 0 * * * <my_command>
which should run at 00:01 AM everyday.
To test this I am setting the system time as follows :
date --set="2010-12-28 23:59:45"
Date is getting set properly, but cron job is not getting executed at 00:01AM.
If I restart 'cron' I see following log in /var/log/syslog :
Dec 28 13:20:53 v-sys2 init: cron main process (10015) killed by TERM signal
Dec 28 13:20:53 v-sys2 cron[10033]: (CRON) INFO (pidfile fd = 3)
Dec 28 13:20:53 v-sys2 cron[10034]: (CRON) STARTUP (fork ok)
Dec 28 13:20:53 v-sys2 cron[10034]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
If I give the command :
$ logger hi
/var/log/messages also show "Dec 28 13:24:00" timestamp.
Why is there difference in the time shown by 'date' command and the timestamp in the syslog/messages files?
Regards,
Girish
Last edited by girish_hilage; 01-04-2011 at 03:32 AM.
Playing around with system time and date setting can cause pretty strange behaviour. I would advice you to change the execution time in your crontab for example to 5 minutes in the future. That I believe is preferred over changing the system time, which can act up if you have for example NTP running. Setting a different execution time in crontab takes less time and causes no problems if all you want to do is check if the command gets executed.
forgot to mention that, the Ubuntu-9.10 I am using is a virtual machine.
so, could this be the reason for not reflecting the changed date in timestamps in syslog/messages files.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.