cron job issue..i hav read the basic threads already...

hi friends

well m facing a different sort of issue in my cron.
i hav set job like this

30 09 * * 1 /bin/backup14M
01 14 * * 1 /bin/backup14N
20 18 * * 1 /bin/backup14E

that is for every Monday at three different times.
but, first job executes well, later ones do not. I checked my scrip result at 14:05 hrs, and it was not executed, i change the job to 14:08 and it executed well at the specified time, then checked at 18:21 hrs for the output, again it didnt execute, and i changed the time to few more minutes and it executed at that time. All i noticed is, that if i change the time to few minutes, it executes, but it do not execute for big intervals.
Can anybody tell the problem and the respective solution

Mentionable:- I hav the checked the basic cron forums, so find my issue lil different from the mentioned.. Using centOS 5.3 system.

thanks in advance

I'm not sure what you mean by "big intervals". Can you explain.

Also have you set the HOME, SHELL, and MAILTO... just to to make sure.

See if you get any mail after the event time has passed....

hi JP

from big intervals i mean, like wen i change the schedule with just minutes, it do work, but if the next schedule is after few hours, as i mentioned in my crontab example, it do not run the script

And, m sorry m new to Cron as well as Linux, and m not sure how to set the rest of the attirbutes, and wat exactly do they require for..

and if these attributes do effect, then i believe the cron job shud not work for the rest of jobs as well, that i run if i change the same to minutes.

thanks

Did you restart crontab after scheduling it?

# /etc/init.d/crond stop
# /etc/init.d/crond start

Do a

man -s 5 crontab

It will give you the meaning of the vars and show examples of a crontab using them.

hey Harish

i guess i didnt:-)
this cud be an issue i just did it, let me see, if this help now..:slight_smile:

thanks

---------- Post updated at 11:51 AM ---------- Previous update was at 11:49 AM ----------

yeah m checking that too..

thanks JP

cheers...

You shouldn't have to restart crond. It automatically checks every minute to see if anything has been modified. If yes, then it reloads everything.

And make sure you are using crontab -e to modify the crontab..

  1. There is no such thing as if you have crontab scheduled after long time.

Above is your misunderstanding.

  1. Something else is the mistake....
    Definitely environment, or your script permissions or some thing else ... when you check at 18:21 and scheduling it later .. i hope you are doing something .. which makes the script to execute.

The above is assumption only.

  1. Check your /var/log/syslog to identify this problem. ( in debian )
    Check the same in your OS.

m using CentOS and it is not having that syslog fiel, where else can i get that file ??

---------- Post updated at 03:33 PM ---------- Previous update was at 03:14 PM ----------

I hav checked the log

it was in var/log/cron
it shows that it is taking the script, then why the hell is it not working
i just changed the time to next 2 mins to execute, and it executed perfectly, now its time to execute is at 18:20 and m sure, it will not execute, n i really dont know why...

Ok nice, you;ve located the log in the Cent OS.

But what about the error or execution log ?! Meaning, what did you found useful from there ? At both times -- during non-execution & execution ..

Oct 24 14:01:01 gofenetre crond[11563]: (root) CMD (run-parts /etc/cron.hourly)
Oct 24 14:01:01 gofenetre crond[11564]: (root) CMD (/bin/backup36N)
Oct 24 15:01:01 gofenetre crond[11899]: (root) CMD (run-parts /etc/cron.hourly)
Oct 24 15:28:11 gofenetre crontab[12377]: (root) BEGIN EDIT (root)
Oct 24 15:29:45 gofenetre crontab[12377]: (root) REPLACE (root)
Oct 24 15:29:45 gofenetre crontab[12377]: (root) END EDIT (root)
Oct 24 15:30:01 gofenetre crond[8819]: (root) RELOAD (cron/root)
Oct 24 15:30:01 gofenetre crond[12408]: (root) CMD (/bin/backup36N)

this is last entry for the cron job set
it shows that the job is taking the script at 14:01 hrs
Later i made this modification to my cron job

30 09 * * 6 /bin/backup36M
30 15 * * 6 /bin/backup36N
20 18 * * 6 /bin/backup36E

and the job executed well at 15:30 hrs, giving me the backup of sepcified time, if there wud b any issue of environment variable or anything else, then it shud not hav been executed...

What we need to see is what happened around the time that the jobs should have executed and didn't. I suggests that you set up a crontab. When it fails, post the part of the log that covers 1 hour before the failure time to the end of the file.

Oct 24 18:01:01 gofenetre crond[15482]: (root) CMD (run-parts /etc/cron.hourly)
Oct 24 18:20:01 gofenetre crond[15865]: (root) CMD (/bin/backup36E)

thats the last entry to cron log, and again, the script didnt work...:frowning:

Did you set up the crontab with the variables MAILTO, HOME, and SHELL? Where there any mail messages?

Cron is executing the scripts. But there may be a problem related to the expectations of your scripts.