I'm using a script to automate a backup of some of my data to a remote server. It compresses the selected folders, encrypts them with GPG, and ships them off with scp. When run from the command line, the script works fine ... when run as a cron job, though, the script fails, and the log file that it creates just ends with:
Code: Select all
tar: -: Cannot write: Broken pipe
tar: Error is not recoverable: exiting now
Code: Select all
# !/bin/bash
tar c -PSvv --to-stdout --exclude=".thumbnails" --exclude-tag-under=".SkipMe" /home/patrick/Documents/school /home/patrick/Documents/writing 2> /home/patrick/Desktop/remote-backup.log | bzip2 -z 2>> /home/patrick/Desktop/remote-backup.log | gpg2 -r 505AB18E --batch -o "/tmp/Backup.tar.bz2.gpg" -e - > /home/patrick/Desktop/remote-backup.log && scp /tmp/Backup.tar.bz2.gpg patrickmooney@ustorage.ucsb.edu:backups 2>> /home/patrick/Desktop/remote-backup.log
if [ -d /media/Externa/backups ]; then
cp /tmp/Backup.tar.bz2.gpg /media/Externa/backups/
fi
rm /tmp/Backup.tar.bz2.gpg
chown patrick:patrick /home/patrick/Desktop/remote-backup.log
Code: Select all
30 6 * * * /home/patrick/.scripts/backup-remote.sh
Currently running Linux Mint Julia on an HP Pavilion dv6000, 2GB RAM, 2 GHz Intel Core Duo.