1837527 Members
3576 Online
110117 Solutions
New Discussion

Re: Cron Job

 
SOLVED
Go to solution
Cat_4
Advisor

Cron Job

I changed my cron schedule from 21:50 to 21:30 last night by crontab -e. However, I found the job run 2 times: one is 21:30 and the other is 22:00.

1. Could anyone tell me why this unexpected cron job run again ?? And why the time is 22:00 ??

2. Is that any guilelines for schedule a cron job ? for example, avoid running different job at the same time ??

thanks in advance.

best regards,
Cat

p.s. My editing time is 21:27, but I don't think they are related ...
8 REPLIES 8
Patrick Wallek
Honored Contributor

Re: Cron Job

Can you post the output of 'crontab -l' so we can see what is in the crontab.

Unless you have the job specified twice in cron, there really isn't a way for cron to run it twice.

Re: Cron Job

your crontab entry should look like the following in order to run at 21:30 every night.

30 21 * * * /path/to/job_to_run


I would check for a double entry as well.


HTH
Jeremiah
Cat_4
Advisor

Re: Cron Job

the crontab -l :

30 21 6,10,13,17,20,27 3 * /usr/bin/su -root -c /home/chess32/chess32_mrp

Solution

Re: Cron Job

that appears to be correct if you want to run the script on the 6th,10th,13th,17th,20th, & 27th of March at 21:30.

I also see that you are doing an su to root, Is this the crontab for an alternate user? If that is the case, then have you checked everyones crontab to ensure that their is not a duplicate in someone elses crontab?
Patrick Wallek
Honored Contributor

Re: Cron Job

You can also have a look at the /var/adm/cron/log file to see what / what started the job at 22:00.

I would also question why you are doing an 'su - root' in the crontab. Why not just run the job from root's crontab?
Steven E. Protter
Exalted Contributor

Re: Cron Job

There are no guidelines as to when you run things.

Things to remember.

You have no environment, no path.

If you want to use a utility in your script, use the full path name.

Post the crontab entry, but if it runs when you don't expect it, its probably just a typo.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Cat_4
Advisor

Re: Cron Job

thanks for all your advice. i should regard this as typo error. Hope it won't be happened again.

Cheers !

Yogeeraj_1
Honored Contributor

Re: Cron Job

hi,

i usually use the following template for my crontabs. This elimates all the risks of any typo errors.

e.g.

#*******************************************************************************
# min|hour |day |month|day |script
# | |of mo| |of wk|
#----|-----|-----|-----|-----|--------------------------------------------------
#*******************************************************************************

#*******************************************************************************
# END OF TABLE day0->Sunday day6->Saturday
#*******************************************************************************


Hope this helps!

regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)