Source: etc-obnam
-Section: unknown
+Section: optional
Priority: extra
Maintainer: Andrew Ruthven <andrew@etc.gen.nz>
Build-Depends: debhelper (>= 7.0.50~)
Standards-Version: 3.8.4
-Homepage: <insert the upstream URL, if relevant>
Vcs-Git: git://git.etc.gen.nz/etc-obnam.git
Vcs-Browser: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?p=etc-obnam.git;a=summary
Package: etc-obnam
Architecture: all
Depends: ${misc:Depends}
-Recommends: obnam
+Recommends: obnam, molly-guard
Description: Wrapper around obnam for backing up laptops and PCs
Runs obnam on a schedule, but only if we're on the right network.
obnam.list /etc/apt/sources.list.d/
run-backup /usr/lib/etc-obnam/
+molly-guard/45-obnam /etc/molly-guard/run.d
Summary: Drop molly-guard hook into place to block reboots when backing up.
-Status: New
+Status: Finished
CreatedBy: Andrew Ruthven <andrew@etc.gen.nz>
AssignedTo: andrew
Inserted: 2012-04-26T08:57:44
-Updated: 2012-04-26T08:58:37
+Updated: 2012-04-26T09:27:24
Drop in a molly-guard file to make it harder to reboot during a backup.
--- /dev/null
+#!/bin/sh
+
+ME=molly-guard
+
+COUNT=$(ps ax | grep obnam | grep -v grep | wc -l)
+if [ $COUNT -eq 0 ]; then
+ echo "I: I can't find any running obnam backups, skipping check" >&2
+ exit 0;
+fi
+
+HOSTNAME="$(hostname --short)"
+
+sigh()
+{
+ echo "Good thing I asked; I won't $MOLLYGUARD_CMD $HOSTNAME ..." >&2
+ exit 1
+}
+
+
+trap 'echo;sigh' 1 2 3 9 10 12 15
+echo -n "Obnam is running a backup. Type YES to $MOLLYGUARD_CMD: "
+read CONFIRM || :
+
+[ $(echo "x$CONFIRM" | tr 'A-Z' 'a-z') = "xyes" ] || sigh
+
+trap - 1 2 3 9 10 12 15
+
+exit 0
+