0

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

3
Contributors
16
Replies
17
Views
8 Years
Discussion Span
Last Post by aman_dba
0

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

Hi

Did you check crontab logs?

0

Hi

Did you check crontab logs?

hey

yeah i did...its showing that its taking that script at that very interval, but the script is not executing..

0

hey

yeah i did...its showing that its taking that script at that very interval, but the script is not executing..

Why you split your crontab into multiple lines? try this

30 9,14 * * 1 /bin/backup14M
0

Why you split your crontab into multiple lines? try this

30 9,14 * * 1 /bin/backup14M

i hav to run different scripts on different timings, thats why i hav split in different lines.

0

i hav to run different scripts on different timings, thats why i hav split in different lines.

hmm..

Then you need to see the output of your script while its execute. like.

01 14 * * 1 /bin/backup14N | mail -s "Your second script" i_tears@techbabu.com
0

hmm..

Then you need to see the output of your script while its execute. like.

01 14 * * 1 /bin/backup14N | mail -s "Your second script" i_tears@techbabu.com

well, the problem is, my sendmail is also not working. I hav checked the logs of cron, n it is simply showing that cron is taking that script, but i dunno why, i am not getting the script output.If i run script directly on the terminal, or if i set the cronjob to next few minutes, it executes very comfortably. This is wat surprising me alot...

0

well, the problem is, my sendmail is also not working. I hav checked the logs of cron, n it is simply showing that cron is taking that script, but i dunno why, i am not getting the script output.If i run script directly on the terminal, or if i set the cronjob to next few minutes, it executes very comfortably. This is wat surprising me alot...

hmm

Which OS you are using? and how many minutes you extended?. Try to use this.

1 14 * * 1 /bin/backup14N

Remove 0 from minutes. I think problem with 01,02,03,04,05,06,07,08,09. You don't need to put 0.

0

hmm

Which OS you are using? and how many minutes you extended?. Try to use this.

1 14 * * 1 /bin/backup14N

Remove 0 from minutes. I think problem with 01,02,03,04,05,06,07,08,09. You don't need to put 0.

M using centOS, n i believe if i use few minutes like 5 to 10 mins, the cron job is running.
By any chance, do u think that cron goes to sleep mode, after some interval of time??
and 0 is not any issue, coz i also have set jobs like
30 9 * * *
and
20 18 * * *
and they are also not executing at their intervals...

0

M using centOS, n i believe if i use few minutes like 5 to 10 mins, the cron job is running.
By any chance, do u think that cron goes to sleep mode, after some interval of time??
and 0 is not any issue, coz i also have set jobs like
30 9 * * *
and
20 18 * * *
and they are also not executing at their intervals...

I don't think so about sleep mode.

I meant 01 not 10 or 20 or 30. I think you should try with 1,2,3,4,5,6,7,8,9 don't put 0 in single minute value.

And please send me cron logs.

0

I don't think so about sleep mode.

I meant 01 not 10 or 20 or 30. I think you should try with 1,2,3,4,5,6,7,8,9 don't put 0 in single minute value.

And please send me cron logs.

Oct 28 09:01:01 server crond[4040]: (root) CMD (run-parts /etc/cron.hourly)
Oct 28 09:30:01 server crond[4333]: (root) CMD (/bin/backup36M)

this is last log entry, and this script didnt work and i understand wat u r talking abt, but i meant to say, that if i set jobs at 18:30 hrs or 9:20 hrs, that job is also not working, so it shud not b any issue with 0 at single minutes, as other jobs are not working as well...

0

Oct 28 09:01:01 server crond[4040]: (root) CMD (run-parts /etc/cron.hourly)
Oct 28 09:30:01 server crond[4333]: (root) CMD (/bin/backup36M)

this is last log entry, and this script didnt work and i understand wat u r talking abt, but i meant to say, that if i set jobs at 18:30 hrs or 9:20 hrs, that job is also not working, so it shud not b any issue with 0 at single minutes, as other jobs are not working as well...

Hmmm.

Would you please write down here your crontab entries and also tell how much time take your first script to complete its process.

You need to check your system process in that time when your second script running through crontab.

0

Hmmm.

Would you please write down here your crontab entries and also tell how much time take your first script to complete its process.

You need to check your system process in that time when your second script running through crontab.

entry for my crontab

30 09 * * 3 /bin/backup36M
01 14 * * 3 /bin/backup36N
20 18 * * 3 /bin/backup36E


it takes almost 40 secs to execute a script

and m sry, i don know how to check system process..if u can guide for the same as well

thanks

0

entry for my crontab

30 09 * * 3 /bin/backup36M
01 14 * * 3 /bin/backup36N
20 18 * * 3 /bin/backup36E


it takes almost 40 secs to execute a script

and m sry, i don know how to check system process..if u can guide for the same as well

thanks

Hmmm.

You can see process with many ways like (top, ps) etc. Let's try to solve your problem.

create a filed like /home/checkmycron.sh. In this file paste these lines.

#!/bin/sh
stamp=`/usr/bin/date | awk '{print $4}'`
/usr/bin/mkdir /tmp/my_test_dir-$stamp

save the file and make it executable with this command.

chmod +x /home/checkmycron.sh

Make sure (date and mkdir) path. Because some time cron is not working without complete path.

The above script will create a file in /tmp/my_test_dir with time stamp. You just need to add this script in crontab like.

30 09 * * 3 /home/checkmycron.sh
01 14 * * 3 /home/checkmycron.sh
20 18 * * 3 /home/checkmycron.sh

On 18:20 check your /tmp/ directory there should be three files created. If you find 3 files with the time stamp as per your crontab then there is no problem with your crontab & we will do next step.

0

You might also try appending "> /tmp/cronout.log" to the job to see if you get any error output from the execution. Could be a problem with the environment that the script is running in, too.

0

Hmmm.

You can see process with many ways like (top, ps) etc. Let's try to solve your problem.

create a filed like /home/checkmycron.sh. In this file paste these lines.

#!/bin/sh
stamp=`/usr/bin/date | awk '{print $4}'`
/usr/bin/mkdir /tmp/my_test_dir-$stamp

save the file and make it executable with this command.

chmod +x /home/checkmycron.sh

Make sure (date and mkdir) path. Because some time cron is not working without complete path.

The above script will create a file in /tmp/my_test_dir with time stamp. You just need to add this script in crontab like.

30 09 * * 3 /home/checkmycron.sh
01 14 * * 3 /home/checkmycron.sh
20 18 * * 3 /home/checkmycron.sh

On 18:20 check your /tmp/ directory there should be three files created. If you find 3 files with the time stamp as per your crontab then there is no problem with your crontab & we will do next step.

No such files are created, not even the my_test_dir directory in /tmp directory...

I believe its case with cron only, not with script or environment..

Edited by aman_dba: n/a

0

You might also try appending "> /tmp/cronout.log" to the job to see if you get any error output from the execution. Could be a problem with the environment that the script is running in, too.

I hav not got any such log file under /tmp directory, is there any other possible location for the same???

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.