LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-26-2013, 07:09 AM   #1
project.linux.proj
Member
 
Registered: Dec 2012
Posts: 80

Rep: Reputation: Disabled
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
 
Old 06-26-2013, 02:20 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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.
 
Old 06-27-2013, 05:30 AM   #3
project.linux.proj
Member
 
Registered: Dec 2012
Posts: 80

Original Poster
Rep: Reputation: Disabled
I created /tmp/mohit just for checking that crond has no issue. It is working but other is not.
 
Old 06-27-2013, 03:23 PM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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=....).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error from script running under cron halbert5150 Linux - General 1 03-20-2013 10:34 AM
cron job running PHP script to update MySQL - access denied error Beauford2008 Linux - Newbie 9 09-24-2008 07:17 PM
cron NOT running php script ??!! hendrixx Linux - Software 2 11-15-2006 07:18 AM
cron NOT running php script ??!! hendrixx Programming 1 01-19-2005 05:36 AM
cron error when running script? meeble Linux - Software 3 09-09-2004 05:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration