| 1 |
#!/bin/sh |
| 2 |
# driver |
| 3 |
# entry point for inittab (or perhaps cron) to run the backups. |
| 4 |
# |
| 5 |
# This file is part of chiark backup, a system for backing up GNU/Linux and |
| 6 |
# other UN*X-compatible machines, as used on chiark.greenend.org.uk. |
| 7 |
# |
| 8 |
# chiark backup is: |
| 9 |
# Copyright (C) 1997-1998,2000-2001,2007 |
| 10 |
# Ian Jackson <[email protected]> |
| 11 |
# Copyright (C) 1999 Peter Maydell <[email protected]> |
| 12 |
# |
| 13 |
# This is free software; you can redistribute it and/or modify it under the |
| 14 |
# terms of the GNU General Public License as published by the Free Software |
| 15 |
# Foundation; either version 3, or (at your option) any later version. |
| 16 |
# |
| 17 |
# This is distributed in the hope that it will be useful, but WITHOUT ANY |
| 18 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 19 |
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 20 |
# details. |
| 21 |
# |
| 22 |
# You should have received a copy of the GNU General Public License along |
| 23 |
# with this program; if not, consult the Free Software Foundation's |
| 24 |
# website at www.fsf.org, or the GNU Project website at www.gnu.org. |
| 25 |
|
| 26 |
cd /var/lib/chiark-backup |
| 27 |
PATH=/usr/share/chiark-backup:$PATH export PATH |
| 28 |
|
| 29 |
if [ "x$1" != test ]; then |
| 30 |
stty sane |
| 31 |
stty -isig |
| 32 |
fi |
| 33 |
|
| 34 |
rm -f this-status p p2 |
| 35 |
echo 'FAILED to start dump script' >this-status |
| 36 |
|
| 37 |
# Here we go : run 'full', which (name notwithstanding) handles |
| 38 |
# both full and incremental backups, according to the ID of the |
| 39 |
# tape in the drive. |
| 40 |
(full; snap-drop) 2>&1 | tee this-log |
| 41 |
|
| 42 |
status=`cat this-status 2>/dev/null` |
| 43 |
|
| 44 |
# Mail a report to somewhere appropriate; -odq removed (means just |
| 45 |
# queue message, don't try to deliver) because it just delays the |
| 46 |
# message (you might want that if mail was one of the services turned |
| 47 |
# off for the duration of the backup, though). |
| 48 |
cat <<END - this-log | /usr/lib/sendmail -oi -om -oee -t |
| 49 |
To: dump-reports |
| 50 |
Subject: Dump Report: $status |
| 51 |
|
| 52 |
END |
| 53 |
|
| 54 |
rm -f /TAPEID |
| 55 |
|
| 56 |
if [ "x$1" != test ]; then |
| 57 |
# Bring the system up as multiuser again |
| 58 |
bringup |
| 59 |
stty isig |
| 60 |
fi |