hsthompson
Registered
I've written a bash script which uses rsync (rsync.sh) to back up a user's home folder. Some directories can be excluded, so I've specified an external file (filelist.txt) for the include-from and exclude-from options. The script is run from the source machine. The rsync command uses ssh, with an alternate port, to connect to a remote machine. The -E option is also used, to preserve resource forks under Mac OS X.
If I run the script manually via the Terminal's sh command, it works as expected. However, when I run it via either cron or launchd it fails. The system.log file reports that rsync couldn't find the "include" file. Errors from running via launchd:
The paths, permissions, and contents of the files:
[rwxr-xr-x] ~/shell/backup/rsync.sh
[rwxrwxrwx] ~/shell/backup/filelist.txt
The rsync installed is version 2.6.9.
Mac Pro, Snow Leopard 10.6.7
What am I doing wrong?
If I run the script manually via the Terminal's sh command, it works as expected. However, when I run it via either cron or launchd it fails. The system.log file reports that rsync couldn't find the "include" file. Errors from running via launchd:
Code:
May 13 00:32:22 The-Users-Mac-Pro com.apple.launchd.peruser.501[108] (com.company.backup[11548]): Exited with exit code: 11
May 13 00:32:22 The-Users-Mac-Pro com.apple.launchd.peruser.501[108] (com.company.backup): Throttling respawn: Will start in 10 seconds
May 13 00:32:32 The-Users-Mac-Pro com.company.backup[11550]: rsync: failed to open include file filelist.txt: No such file or directory (2)
May 13 00:32:32 The-Users-Mac-Pro com.company.backup[11550]: rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-40/rsync/exclude.c(1005) [client=2.6.9]
The paths, permissions, and contents of the files:
[rwxr-xr-x] ~/shell/backup/rsync.sh
Code:
#! /bin/sh
rsync -e "ssh -p 2223" -aiEvz --include-from 'filelist.txt' --exclude-from 'filelist.txt' ~ companyg5@company-remote-backup-1.gotdns.com:~/Documents/g5_nas_users_bk/mv/
[rwxrwxrwx] ~/shell/backup/filelist.txt
Code:
+ /shell/
+ /Sites/
+ /Documents/Clients/
+ /Documents/company_Builds/
+ /Documents/company_Docs/
+ /Documents/
- /Documents/*
- /*
The rsync installed is version 2.6.9.
Mac Pro, Snow Leopard 10.6.7
What am I doing wrong?