I have a script that runs make fine from terminal but throws error when I am running through Cronjob.

The script in ypxfr.sc:

make -f /var/yp/Makefile -C sc auto.nfs.sc.home  2>&1 | sed -e 's/^/\t/g'

The crontab -l:

59 * * * * /var/yp/ypxfr.sc >> /var/log/ypxfr.sc.out 2>&1

The error that I get in ypxfr.sc.out is:

make: *** sc: No such file or directory.  Stop.

The option -C tells make to change to that directory, in this case sc.

Where is this directory sc? You should specify an absolute path here.


The issue has been solved, I had to give the absolute path make -f /var/yp/Makefile -C /var/yp/sc auto.nfs.sc.home 2>&1 | sed -e 's/^/\t/g'


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.