LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   getting error while running script under cron (https://www.linuxquestions.org/questions/linux-newbie-8/getting-error-while-running-script-under-cron-4175467447/)

project.linux.proj 06-26-2013 07:09 AM

getting error while running script under cron
 
Hi,

I have an issue with cronjob with one user with one script. I have tested to set others cronjob with basic command. It worked. but the actual script is not running under cronjob. I tested the script manually it worked. I have centos 6.2 . User is created on AD and using AD (winbind to login). I am getting logs for UNSAFE

Jun 26 08:05:05 DEV-HMAERS1 CROND[14641]: (NYOS\sop_qa) UNSAFE (NYOS\sop_qa)
Jun 26 08:06:01 DEV-HMAERS1 CROND[14702]: (NYOS\sop_qa) CMD (/bin/sh /home/sop_qa/Automation/sop_alerts.sh)
Jun 26 08:06:01 DEV-HMAERS1 CROND[14701]: (NYOS\sop_qa) CMD (touch /tmp/mohit)
Jun 26 08:06:05 DEV-HMAERS1 CROND[14700]: (NYOS\sop_qa) UNSAFE (NYOS\sop_qa)



*/1 * * * * /bin/sh /home/sop_qa/Automation/sop_alerts.sh
*/1 * * * * touch /tmp/mohit

jpollard 06-26-2013 02:20 PM

I think we will need to see the script.

One note - if the /tmp/mohit is supposed to be referenced by sop_alerts.sh you need to realize that both cron jobs will run simultaneously.

project.linux.proj 06-27-2013 05:30 AM

I created /tmp/mohit just for checking that crond has no issue. It is working but other is not.

jpollard 06-27-2013 03:23 PM

IT depends on the script sop_alerts.sh.

Cron runs the job under a different environment - no X for instance, the default PATH is not the same.

You might check the PATH against what you want for the script - then either set it in the script itself (my preference as it lets you know later what the script itself needs), or set it in the crontab (PATH=....).


All times are GMT -5. The time now is 08:08 PM.