chiark / gitweb /
Found on anarres in /var/local/backup.
[chiark-utils.git] / backup / takedown
1 #!/bin/sh
2 #
3 # Take the system down for backups and then bring it back up.
4
5 set -e
6 cd /etc/backup
7
8 host="`hostname`" || true
9
10 T () {
11         (
12                 exec wall <<END &
13  *** WARNING - SYSTEM GOING DOWN FOR BACKUPS ***
14  $host will shut down automatically $2.
15
16 END
17         ) &
18         sleep $1
19 }
20
21 . "warnings.$1"
22
23 (
24         exec wall <<END &
25  *** WARNING - SYSTEM GOING DOWN FOR BACKUPS ***
26
27   $host is shutting down IMMEDIATELY.
28
29 END
30 ) &
31 sleep 1
32
33 telinit 5