diff options
author | Filipp Lepalaan <filipp@mac.com> | 2010-06-20 21:44:58 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2010-06-20 21:44:58 +0300 |
commit | 85406dae0c220759da4b816fa9380c25d72b73ba (patch) | |
tree | 0390e68282697fa7873e3bf44f9abff667359079 /start.sh | |
download | offsync-85406dae0c220759da4b816fa9380c25d72b73ba.tar.gz offsync-85406dae0c220759da4b816fa9380c25d72b73ba.tar.bz2 offsync-85406dae0c220759da4b816fa9380c25d72b73ba.zip |
First commit
Diffstat (limited to 'start.sh')
-rwxr-xr-x | start.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..351474b --- /dev/null +++ b/start.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# offsync/start.sh +# run the offsite backup + +MYDIR=$(dirname $0) +source "${MYDIR}/config" + +if -z "${RSYNC_TARGET}"; then + echo "Check your configuration!" 2>&1 + exit 1 +fi + +date >> "${LOGFILE}" +/usr/local/bin/rsync -auvhNHXxrz\ + --stats --protect-args --fileflags --force-change --delete\ + --files-from="$MYDIR/offsync.include" --no-relative\ + / "${RSYNC_TARGET}" >> "$LOGFILE" 2>&1 & + +echo $! > "$PIDFILE" + +# wait for rsync to finish +wait $(cat "$PIDFILE") +rm "$PIDFILE" + +tail "$LOGFILE" | mail -E -s "Offsite backup of $(hostname) completed" $MAILTO |