chiark / gitweb /
Found on davenant in /usr/local/lib (in use on anarres).
[chiark-utils.git] / backup / takedown
diff --git a/backup/takedown b/backup/takedown
new file mode 100755 (executable)
index 0000000..158347b
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Take the system down for backups and then bring it back up.
+
+set -e
+cd /etc/backup
+
+host="`hostname`" || true
+
+T () {
+       (
+               exec wall <<END &
+ *** WARNING - SYSTEM GOING DOWN FOR BACKUPS ***
+ $host will shut down automatically $2.
+
+END
+       ) &
+       sleep $1
+}
+
+. "warnings.$1"
+
+(
+       exec wall <<END &
+ *** WARNING - SYSTEM GOING DOWN FOR BACKUPS ***
+
+  $host is shutting down IMMEDIATELY.
+
+END
+) &
+sleep 1
+
+telinit 5