chiark / gitweb /
3cede61e8e0926ea27756dadd9a40d51cfd41c2f
[chiark-utils.git] / backup / driver
1 #!/bin/sh
2 # This is the driver script that actually runs backups.
3
4 cd /var/local/backup
5 PATH=/usr/local/lib/backup:$PATH export PATH
6
7 if [ "x$1" != test ]; then
8         stty sane
9         stty -isig
10 fi
11
12 rm -f this-status p p2
13 echo 'FAILED to start dump script' >this-status
14
15 # Here we go : run 'full', which (name notwithstanding) handles
16 # both full and incremental backups, according to the ID of the
17 # tape in the drive.
18 full 2>&1 | tee this-log
19
20 status=`cat this-status 2>/dev/null`
21
22 # Mail a report to somewhere appropriate; -odq removed (means just 
23 # queue message, don't try to deliver) because it just delays the
24 # message (you might want that if mail was one of the services turned
25 # off for the duration of the backup, though).
26 cat <<END - this-log | /usr/lib/sendmail -oi -om -oee -t
27 To: dump-reports
28 Subject: Dump Report: $status
29
30 END
31
32 rm -f /TAPEID
33
34 if [ "x$1" != test ]; then
35         # Bring the system up as multiuser again
36         bringup
37         stty isig
38 fi