0

I have a simple shell script that runs Rsync. It runs fine if I call it manually from the command line, but when I set it up as a CRON job I get the following error:

rsync: failed to open exclude file exclude.txt: No such file or directory (2)
rsync error: error in file IO (code 11) at exclude.c(1000) [client=2.6.8]

I use the following in the shell script:

--exclude-from 'exclude.txt'

The file exists and the script runs fine (honoring the exclusions) when run manually. The shell script being called by the CRON job and exclude.txt are in the same directory.

The entire script I'm trying to run looks like this:

rsync -avrhgo --exclude-from 'exclude.txt' --progress --stats --delete-excluded -e "ssh -p XXXXX" / XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1 Answer 1

3

You will need to specify the full path to the exclude file, as the working directory of the script will not be automatically the one from where you start the script, but instead the cron job owners home directory.

Alternatively, you can cd into the correct directory from inside your shell script.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .