Operating System - HP-UX
1748239 Members
3689 Online
108759 Solutions
New Discussion юеВ

Re: crontab erroring out with rc=1

 
siddharthC
Occasional Advisor

Re: crontab erroring out with rc=1

I have sourced the required environment but still getting the same error.
OldSchool
Honored Contributor

Re: crontab erroring out with rc=1

Don't recall the "bash" syntax, but there should be something along the lines of "set -x" that will cause each command to echo prior to execution.

Try that and see if it will tell you which command is failing.

Its almost got to be either a path issue, or possibly something from the .bashrc file that needs to be set up in the script for it to run
Jonathan Fife
Honored Contributor

Re: crontab erroring out with rc=1

Let's add some additional debugging. Add a -x in the shell invocation line:

#!/bin/bash -x

And redirect all output to a separate log file. e.g.:

30 * * * * . /data/vision/scripts/test.sh > /tmp/test.log 2>&1

What is in /tmp/test.log after that runs?
Decay is inherent in all compounded things. Strive on with diligence
A. Clay Stephenson
Acclaimed Contributor

Re: crontab erroring out with rc=1

Sourcing .profile may not work because almost certainly the .profile has commands like tput, tset, tabs, ... which expect stdin to a tty device so you would have to
surround those commands with something like
if [ -t 0 ]
then
tput
...
fi

or better still have your cron'ed script and .profile source a file which sets and exports the needed environment variables.
If it ain't broke, I can fix that.
siddharthC
Occasional Advisor

Re: crontab erroring out with rc=1

Hi ,

I have tried including the .profile and environment. Still no sucess. Enclosed is the debug file.