Hi everyone
I have a rsync script that I want to run daily. The script works 100% fine when run from the CLI, and I've made sure to use full paths for both files, folders and executables.
I've set up the script to run daily using the FreeNAS GUI, calling the command:
The script itself:
When run from the CLI, I get a log file named by the current date, starting with the line "Daily NAS Backup to Cloud:" followed by rsync's "sending incremental file list..." and then a list of each file that was backed up by rsync (the output of the rsync command).
However, when run as a Cron job the log file and "Daily NAS Backup to Cloud:" line is there, but none of the rsync output - no "sending incremental file list..." and no files have been copied. The rsync command is obviously not working.
Any ideas where I'm going wrong?
Thanks!
I have a rsync script that I want to run daily. The script works 100% fine when run from the CLI, and I've made sure to use full paths for both files, folders and executables.
I've set up the script to run daily using the FreeNAS GUI, calling the command:
/bin/sh /mnt/storage/utils/cloud-backup-daily.sh
The script itself:
Code:
#!/bin/bash YEAR=`date +"%Y"` MONTH=`date +"%m-%B"` FULLDATE=`date +"%Y.%m.%d"` LOGDIR=/mnt/storage/logs/$YEAR/$MONTH LOGFILE=$LOGDIR/daily-nas-to-cloud-$FULLDATE.txt EXCLUDELIST=/mnt/storage/utils/exclude-list.txt BACKUPSRC=/mnt/storage/backups/daily/ BACKUPDEST=(IP address of my backup server):daily/ /bin/mkdir -p $LOGDIR /bin/echo "Daily NAS Backup to Cloud:" > $LOGFILE /bin/echo "" >> $LOGFILE /usr/local/bin/rsync -avHz --progress --delete --exclude-from $EXCLUDELIST --delete-excluded $BACKUPSRC $BACKUPDEST >> $LOGFILE
When run from the CLI, I get a log file named by the current date, starting with the line "Daily NAS Backup to Cloud:" followed by rsync's "sending incremental file list..." and then a list of each file that was backed up by rsync (the output of the rsync command).
However, when run as a Cron job the log file and "Daily NAS Backup to Cloud:" line is there, but none of the rsync output - no "sending incremental file list..." and no files have been copied. The rsync command is obviously not working.
Any ideas where I'm going wrong?
Thanks!