0

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

The script in ypxfr.sc:

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

The crontab -l:

SHELL=/bin/bash
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.
2

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.

0

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.