LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 12-29-2010, 05:19 AM   #1
girish_hilage
Member
 
Registered: Oct 2003
Posts: 78

Rep: Reputation: 15
cron job on ubuntu


Hi,

I have a porblem running cron job on ubuntu-9.10

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 04:32 AM.
 
Old 12-29-2010, 05:37 AM   #2
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291
Hi,

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.

Kind regards,

Eric
 
Old 12-30-2010, 12:49 AM   #3
girish_hilage
Member
 
Registered: Oct 2003
Posts: 78

Original Poster
Rep: Reputation: 15
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.
 
Old 12-30-2010, 02:07 AM   #4
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291
Hello,

As far as my experience with virtual machines goes that shouldn't be of influence on the timestamps in your logs.

Kind regards,

Eric

Last edited by EricTRA; 12-30-2010 at 02:24 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron job not working - Ubuntu jtadeo Linux - Newbie 16 11-04-2010 08:44 PM
cron job to create and move backup from ubuntu to windows. onlykishore07 Linux - Newbie 1 06-15-2010 02:49 PM
linux cron job duplicate job question cpthk Linux - Newbie 4 09-11-2009 09:52 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
cron job Thulemanden Linux - General 1 11-06-2006 12:40 PM


All times are GMT -5. The time now is 02:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration