summaryrefslogtreecommitdiff
path: root/misc/rsnapshot/contrib/rsnapshot_daily
diff options
context:
space:
mode:
Diffstat (limited to 'misc/rsnapshot/contrib/rsnapshot_daily')
-rw-r--r--misc/rsnapshot/contrib/rsnapshot_daily23
1 files changed, 23 insertions, 0 deletions
diff --git a/misc/rsnapshot/contrib/rsnapshot_daily b/misc/rsnapshot/contrib/rsnapshot_daily
new file mode 100644
index 0000000000..32d1e8acec
--- /dev/null
+++ b/misc/rsnapshot/contrib/rsnapshot_daily
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+INTERVAL="daily"
+RSNAPSHOT="/usr/bin/rsnapshot"
+MOUNTPOINT="/backup"
+LOGFILE="/var/log/rsnapshot"
+PIDFILE="/var/run/rsnapshot.pid"
+
+# Check to make sure rsnapshot isn't currently running
+
+if [[ -f "$PIDFILE" ]]; then
+ echo "$PIDFILE already exists, skipping "$INTERVAL" run" >> "$LOGFILE"
+ exit
+fi
+
+# remount filesystem read/write
+mount -o remount,rw "$MOUNTPOINT"
+
+# call rsnapshot
+"$RSNAPSHOT" "$INTERVAL"
+
+# remount filesystem read-only
+mount -o remount,ro "$MOUNTPOINT"