aboutsummaryrefslogtreecommitdiffstats
path: root/start.sh
diff options
context:
space:
mode:
Diffstat (limited to 'start.sh')
-rwxr-xr-xstart.sh25
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