Operating System - HP-UX
1745865 Members
4325 Online
108723 Solutions
New Discussion юеВ

Re: Cron log showing error as rc=1

 
SOLVED
Go to solution
Dennis Handly
Acclaimed Contributor

Re: Cron log showing error as rc=1

>May I know why the script failed and what is the meaning of rc=1 in cron log file.

You'll need to debug your script to find which command is returning a bad exit status.

From your script fragment:
if [[ -d /oracle/abcadmin/lost+found ]]; then
...
rm -f /home/abcd/data/receive/*
else
exit
fi

You may want to reverse the logic so you don't have too much indentation:
if [[ ! -d /oracle/abcadmin/lost+found ]]; then
exit
fi
...
rm -f /home/abcd/data/receive/*

Typically that "rm -f" shouldn't return an error unless there is a permission issue.

If it fails somewhere above, you would have to use Bill's "set -x" to track it.

>Bill: For most commands, the return code is the error number, also known as errno, and errno=1 means:

Not always. 1 is the standard bad exit status value: EXIT_FAILURE
Venkatesan_5
Frequent Advisor

Re: Cron log showing error as rc=1

Hi All,

Thanks for your valuable reply.

The issue is resolved now.

The culprit is the first line in the script
if [[ -d /oracle/abcadmin/lost+found ]]

the file /oracle/abcadmin/lost+found was not found due to which the script failed.

We changed the script and now its working.

Regards,

Venkatesan.
OldSchool
Honored Contributor

Re: Cron log showing error as rc=1

gee...thanks....i told you exactly where to look, and it wasn't all that helpful??????
Dennis Handly
Acclaimed Contributor

Re: Cron log showing error as rc=1

>The culprit is the first line in the script
if [[ -d /oracle/abcadmin/lost+found ]]
>the file /oracle/abcadmin/lost+found was not found due to which the script failed.

That's strange, ksh says:
-d file True if file exists and is a directory.

So this should fall into your final exit.