Script not runing from cron
Dear all,
Linux RHEL 5 ES We have the below entry in the cron 00 08 * * * sh /scripts/Shrink_MSM_ROM_RAT.sh > /scripts/Shrink_MSM.log when am running it manually it works fine, but not from the crom. Folder /scripts readable and writable by all the users Please advise Kai |
Quote:
* * * * * env > /tmp/env.output not working |
Anything about cron in the system logs, or in e-Mail to the owner of that cron-tab entry?
|
Do you have a blank line between your command and the end of the crontab? I've noticed before on my systems that if there isn't a blank line after the last cron entry, it won't run.
|
Quote:
Mar 22 00:51:21 mederpdb1 crontab[26657]: (oracle) LIST (oracle) Mar 22 00:51:47 mederpdb1 crontab[28982]: (oracle) BEGIN EDIT (oracle) Mar 22 00:51:55 mederpdb1 crontab[28982]: (oracle) REPLACE (oracle) Mar 22 00:51:55 mederpdb1 crontab[28982]: (oracle) END EDIT (oracle) Mar 22 00:52:01 mederpdb1 crond[4629]: (oracle) RELOAD (cron/oracle) Mar 22 00:55:43 mederpdb1 crontab[18559]: (oracle) BEGIN EDIT (oracle) Mar 22 00:56:25 mederpdb1 crontab[18559]: (oracle) REPLACE (oracle) Mar 22 00:56:25 mederpdb1 crontab[18559]: (oracle) END EDIT (oracle) Mar 22 00:57:01 mederpdb1 crond[4629]: (oracle) RELOAD (cron/oracle) Mar 22 00:57:58 mederpdb1 crontab[30992]: (oracle) LIST (oracle) Mar 22 00:59:13 mederpdb1 crontab[5615]: (oracle) BEGIN EDIT (oracle) Mar 22 00:59:36 mederpdb1 crontab[5615]: (oracle) END EDIT (oracle) Mar 22 01:00:01 mederpdb1 crond[10129]: (root) CMD (/usr/lib/sa/sa1 1 1) Mar 22 01:01:01 mederpdb1 crond[15635]: (root) CMD (run-parts /etc/cron.hourly) Mar 22 01:01:26 mederpdb1 crontab[18035]: (oracle) BEGIN EDIT (oracle) Mar 22 01:02:23 mederpdb1 crontab[18035]: (oracle) REPLACE (oracle) Mar 22 01:02:23 mederpdb1 crontab[18035]: (oracle) END EDIT (oracle) Mar 22 01:02:41 mederpdb1 crontab[24905]: (oracle) BEGIN EDIT (oracle) Mar 22 01:02:48 mederpdb1 crontab[24905]: (oracle) REPLACE (oracle) Mar 22 01:02:48 mederpdb1 crontab[24905]: (oracle) END EDIT (oracle) Mar 22 01:03:01 mederpdb1 crond[4629]: (oracle) RELOAD (cron/oracle) Mar 22 01:03:41 mederpdb1 crontab[30507]: (oracle) BEGIN EDIT (oracle) Mar 22 01:03:53 mederpdb1 crontab[30507]: (oracle) END EDIT (oracle) Mar 22 01:03:58 mederpdb1 crontab[32120]: (oracle) BEGIN EDIT (oracle) Mar 22 01:04:10 mederpdb1 crontab[32120]: (oracle) REPLACE (oracle) Mar 22 01:04:10 mederpdb1 crontab[32120]: (oracle) END EDIT (oracle) Mar 22 01:04:13 mederpdb1 crontab[1172]: (oracle) LIST (oracle) Mar 22 01:05:01 mederpdb1 crond[4629]: (oracle) RELOAD (cron/oracle) |
Quote:
|
Quote:
|
crontab entries run in a special environment, so maybe sh and env cannot be evaluated. Check PATH variable, or try to use full path:
Code:
00 08 * * * /usr/bin/sh /scripts/Shrink_MSM_ROM_RAT.sh > /scripts/Shrink_MSM.log |
Code:
/scripts/Shrink_MSM_ROM_RAT.sh |
I have had to change working directory on stuff like this before. This may help it may be redundant. I would also capture error stream with 2>&1.
00 08 * * * cd /scripts && /usr/bin/sh Shrink_MSM_ROM_RAT.sh > Shrink_MSM.log 2>&1 |
Thanks , Issue resovled . if am scheduling the cron after 5 minutes from the system time, it works fine.. not immediately. Am sure it doesn't make sense. but it works like that.
Thanks to all Kai |
Hi Kai,
I'm having the same issue. Would appreciate if you post a sample entry of before and after you got it working. Thanks! |
All times are GMT -5. The time now is 02:05 AM. |