cancel
Showing results for 
Search instead for 
Did you mean: 

crontab behaviour

Spark_2
Frequent Advisor

crontab behaviour

Hi,

cron with entry:

0 18 * * 6 sh

is being executed daily...what could be the reason please
14 REPLIES
Hasan Atasoy
Honored Contributor

Re: crontab behaviour

did you edit crontab file directly. or by crontab -e ?.
try stop and start cron deamon.

Hasan
Suraj K Sankari
Honored Contributor

Re: crontab behaviour

Hi,

>>what could be the reason
You are wrong your cron entry will not run daily as per your entry it will run
0 min 18 hr. but every 6 day of week.

In crontab file there are five fields

field allowed values
----- --------------
minute 0-59
hour 0-23
day of month 1-31
month 1-12 (or names, see below)
day of week 0-7 (0 or 7 is Sun, or use names)


For more information see the below link
http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5

Suraj
Michal Kapalka (mikap)
Honored Contributor

Re: crontab behaviour

hi,

check this link :

http://en.wikipedia.org/wiki/Cron

its very good describe.

mikap
Dennis Handly
Acclaimed Contributor

Re: crontab behaviour

This should only work on Sat at 18:00.
I assume you have something other than just "sh" as the command?
Spark_2
Frequent Advisor

Re: crontab behaviour

Yes Dennis...sh has a command further...but it has been executing for last two days...
Pete Randall
Outstanding Contributor

Re: crontab behaviour

What does /var/adm/cron/log show concerning this particular job?


Pete

Pete
Spark_2
Frequent Advisor

Re: crontab behaviour

it gets executed at the mentioned everyday since 2 days...I have checked the logs well
TTr
Honored Contributor

Re: crontab behaviour

> 0 18 * * 6 sh

Where did you get this? Did you type "crontab -l"?

Run crontab -l and check if there is another cron entry for the same "sh" script.

Check what the sh script does when it runs. It could be scheduling itself to run again in 24 hours.
Spark_2
Frequent Advisor

Re: crontab behaviour

have already checked above mentioned two points...

Din_1
Frequent Advisor

Re: crontab behaviour

I too had the similar problem in my env. But when i restarted the Cron deamon it worked...
Dennis Handly
Acclaimed Contributor

Re: crontab behaviour

>have already checked above mentioned two points.

Did you do as Hasan suggested, use "crontab -e" and make a minor change?

I suppose this would only matter if you ever had your crontab entry executing for every day.
Yogeeraj_1
Honored Contributor

Re: crontab behaviour

Hi,

I would suggest that you verify your cronlog to determine the first time the job was executed. Other jobs entries that might be running before and that might have been accidentally been modified.

In the meanwhile you may wish to remove this entry or comment it as:

#0 18 * * 6 sh

hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Spark_2
Frequent Advisor

Re: crontab behaviour

Hi all,

I did two things yesterday.

1. Typed the same entry again and commented old one, suspecting any blank or spl char issue

2. Restarted cron daemon as it seemed user had done some changes few days ago.

Yesterday it didnt run, as required. Still monitoring it for few days.

Thank you all for you suggestions..

I would update after observing it more...
Matti_Kurkela
Honored Contributor

Re: crontab behaviour

Maybe someone has edited the /var/spool/cron/crontabs/ file directly, without using the "crontab -e" command.

The "crontab -e" uses the editor defined in the EDITOR environment variable, or vi if nothing is defined. After the crontab file has been edited, the "crontab" command signals the cron daemon to make it re-read the crontab file. If someone edits the /var/spool/cron/crontabs/ directly, this signalling step is not done and the cron daemon will still use old settings until the daemon is restarted or the reload is triggered.

MK
MK