]> arthur.barton.de Git - backup-script.git/commitdiff
Add "backup-script.{pre|post}-exec" example scripts
authorAlexander Barton <alex@barton.de>
Wed, 8 May 2013 09:35:23 +0000 (11:35 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 8 May 2013 09:35:23 +0000 (11:35 +0200)
examples/backup-script.post-exec [new file with mode: 0755]
examples/backup-script.pre-exec [new file with mode: 0755]

diff --git a/examples/backup-script.post-exec b/examples/backup-script.post-exec
new file mode 100755 (executable)
index 0000000..d7a57c9
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+MOUNTPOINT="/backup"
+
+echo -n "mounting $MOUNTPOINT read-only ... "
+mount -o remount,ro $MOUNTPOINT 2>/dev/null
+[ $? -eq 0 ] && echo "ok." || echo "failed!"
+
+exit 0
+
+# -eof-
diff --git a/examples/backup-script.pre-exec b/examples/backup-script.pre-exec
new file mode 100755 (executable)
index 0000000..1f18d6d
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+MOUNTPOINT="/backup"
+
+echo -n "mounting $MOUNTPOINT read-write ... "
+mount | grep " $MOUNTPOINT " >/dev/null 2>&1
+[ $? -eq 0 ] \
+       && mount -o remount,rw,noatime $MOUNTPOINT \
+       || mount -o rw,noatime $MOUNTPOINT
+if [ $? -eq 0 ]; then
+       echo "ok."
+       exit 0
+else
+       echo "failed!"
+       exit 1
+fi
+
+# -eof-