Home Man
Search
Today's Posts
Register

The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

crontab not working

Tags
crontab, solaris

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 12-20-2011
Question crontab not working

Shell = ksh

Hi all,

I scheduled an automated job on my application server like below,

30 13 * * 1-5 $HOME/my_script.sh

However the script was not executed as expected. Any reason that may cause this to happen?
# 2  
Old 12-20-2011
change to:
30 13 * * 1-5 $HOME/my_script.sh > $HOME/my_script.log 2>&2
to get stdout and stderr output.
I have seen this before - where the environment is NOT set up correctly when running from crontab
You may need to set up expected environmental variables manually.
# 3  
Old 12-21-2011
you need to take the logs for the cron job . Most likely its a env variable issue as cron does not set your env variables by default. You need to check the cronrun log file to find the details . Defile the exact path instead of defining a variable.($HOME/my_script.sh )


PHP Code:
30 13 * * 1-5 $HOME/my_script.sh >> /var/log/cronrun 2>&1
change to
30 13 
* * 1-/USR/dir/my_script.sh >> /var/log/cronrun 2>&
The Following User Says Thank You to amitranjansahu For This Useful Post:
isaacniu (12-21-2011)
# 4  
Old 12-21-2011
If you are using any files or directories inside your my_script.sh, then use the absolute path ( from the root / )
# 5  
Old 12-21-2011
Quote:
Originally Posted by pmm
change to:
30 13 * * 1-5 $HOME/my_script.sh > $HOME/my_script.log 2>&2
to get stdout and stderr output.
I have seen this before - where the environment is NOT set up correctly when running from crontab
You may need to set up expected environmental variables manually.
Yeah, like you said, I defined some variables in that particular script. Probably these variables are not recognised by the Unix environment? So what should I do in such cases?

Manually define them and then export?
# 6  
Old 01-09-2012
This type of problems occur mainly because of improper environment. Please provide the script lines so that we can dig further and suggest which environment variables to use..
Thanks
# 7  
Old 01-09-2012
Quote:
Originally Posted by isaacniu
Yeah, like you said, I defined some variables in that particular script. Probably these variables are not recognised by the Unix environment? So what should I do in such cases?

Manually define them and then export?
On a slightly different path, how did you create the cronjob?
Did you set the shell environment variable to vi? Did you run crontab -e to modify the cronjob file?
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Crontab job is not working ipfreak UNIX for Dummies Questions & Answers 6 03-06-2016 04:39 AM
Crontab is not working BPANDEY Red Hat 5 09-17-2015 10:55 AM
Crontab not working Junaid Subhani Shell Programming and Scripting 7 06-06-2015 03:02 PM
A crontab job not working JDBA SuSE 2 05-05-2014 08:17 AM
Crontab not working krebe Linux 4 02-12-2013 04:50 AM
Crontab not working, please help samantha13 UNIX for Advanced & Expert Users 0 08-02-2012 12:25 PM
crontab is not working!! getrue Red Hat 14 09-08-2011 11:06 AM
crontab is not working. getrue Solaris 6 07-27-2011 12:34 AM
crontab not working rajesh_hv UNIX for Advanced & Expert Users 4 10-28-2008 07:45 AM
crontab not working right kymberm UNIX for Dummies Questions & Answers 3 07-09-2003 04:21 PM


All times are GMT -4. The time now is 06:00 PM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password