1829802 Members
2694 Online
109992 Solutions
New Discussion

Cron Job Problem

 
Hill_1
Frequent Contributor

Cron Job Problem

Hi people,
I use the cron job to auto shutdown the workstations on every 11p.m. Things were getting ok for a week and the workstations could shutdown automatically.
I've read the //usr/lib/cron/log file states that "rc=126" at the right side of the cron statement that can't be done.
What is the solution for this case?
Thanks in advaced.

Unix
6 REPLIES 6
Andreas Voss
Honored Contributor

Re: Cron Job Problem

Hi,

think rc=## is the return code of the cron job (return value $?)
So something has failed and returned this value.
Have you checked the root mail for any reasons ?
Perhaps you have a shutdown command in the cron job but not a cd / at the beginning (just a guess because shutdown only works if the current dir is /)

Regards
Stefan Farrelly
Honored Contributor

Re: Cron Job Problem


error code 126 indicates something is wrong with your crontab entry or file (illegal entry in it). Check you cron file carefully for any mistakes/illegal entries.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Ravi_8
Honored Contributor

Re: Cron Job Problem

Hi,
it is(rc126) is the return code from cron process, u need to check the error code which stands for 126.
never give up
Mehmet Ali Ersoy_1
Occasional Contributor

Re: Cron Job Problem

Hi all ;
I've similar problem.I've wrote a SMS script in order to inform me about status of mount point.It's running from
shell but cron gives me error rc=126.

I've added

01 * * * * * /usr/bin/ksh /SMSScript/check_qsc_arch_check.ksh > /SMSScript/SMSScript.log 2> /SMSScript/SMSScript_error.log
line to cron in order to make script run. But I'm getting "sh:HP: Execute permission denied" error.

My OS version is HP-UX 11.00.

Here is script :
#!/usr/bin/ksh
#This script will check /qsc_arch directory. If it is used more than %80, it will send SMS
export SMSCLASS_PATH="/opt/java1.3/jre/bin"
export BDF="/usr/bin/bdf"
export FIND='/usr/bin/find'
export ARCHDIR="/qscora/oradata/arch"
typeset -i percent_full
percent_full=`$BDF $ARCHDIR|grep $ARCHDIR|awk '{print $5}'|sed 's/%//'`
echo $percent_full
if [ percent_full -ge 6 ]; then
text="\"/qscarch is full by % `echo $percent_full` \""
cd /opt/java1.3/jre/bin/
echo "$SMSCLASS_PATH/java -classpath $SMSCLASS_PATH SMSTest 9230 905552552031 $text 0" > /SMSScript/SMSCmdtext
/usr/bin/ksh /SMSScript/SMSCmdtext

fi


Could you please help me about ?
Kundun
Jacques Carriere
Regular Advisor

Re: Cron Job Problem

I had the same problem. Double check your script if it's executable.
Sandman!
Honored Contributor

Re: Cron Job Problem

Execute your script with debugging on i.e.

# sh -x <script_name>

thru cron and from the command line and compare the differences. This will help in determining the root cause of the problem. Could you also post your script so that it can be examined.

regards!