]> Dogcows Code - chaz/tar/blob - scripts/dump-remind
Added multi-fail.sh
[chaz/tar] / scripts / dump-remind
1 #!/bin/sh
2 # This file is included in the GNU tar distribution as an example. It is
3 # not used by default unless the proper line is uncommented in backup-specs.
4 # System administrators will probably want to customize this and
5 # backup-specs for their site.
6 #
7 # This script should be run by tar with --info-script (-F) to inform
8 # interested parties that a tape for the next volume of the backup needs to
9 # be put in the tape drive.
10 #
11
12 # Include location of `sendmail' and GNU finger.
13 PATH="/usr/lib:/usr/local/gnubin:${PATH}"
14 export PATH
15
16 # Get definition of TAPE_FILE, VOLNO_FILE, and so on.
17 . /home/gd2/dump/backup-specs
18
19 mt -f "${TAPE_FILE}" rewind
20 mt -f "${TAPE_FILE}" offl
21
22 volno="`cat \"${VOLNO_FILE}\" 2> /dev/null`"
23 if [ $? -ne 0 ]; then
24 volno=0
25 fi
26
27 # Get a list of people to whom to mail a request for changing the tape.
28 # This egregious nightmare parses the output from GNU finger which shows
29 # which users are logged into consoles (and thus in the office and capable
30 # of changing tapes).
31 #
32 # Certain users (like `root') aren't real users, and shouldn't be notified.
33 # Neither should `zippy', `elvis', etc. (on the GNU machines) since they're
34 # just test accounts.
35 recipients="`
36 finger .clients 2> /dev/null \
37 | sed -ne '
38 1{
39 /clientstatus: file has not changed in/{
40 n;n;n;n;d
41 }
42 n;n;d
43 }
44 s/^..................................................//
45 $!{/^$/d
46 /^root?*$/d
47 /^zippy$/d
48 /^fnord$/d
49 /^elvis$/d
50 /^snurd$/d
51 H
52 }
53 ${g
54 : 1
55 s/\(\n\)\([A-Za-z0-9_][A-Za-z0-9_]*\)\(\n.*\)\2\(.*\)/\1\2\3\4/g
56 s/\n$//g
57 t 1
58 s/^\n//
59 s/\n$//g
60 s/\n/, /g
61 : 2
62 s/, ,/,/g
63 t 2
64 p
65 }'`"
66
67 # Customized behavior for FSF machines, to bring attention to the fact that
68 # the tape needs to be changed (who looks at the terminal?)
69 sendmail -oi -t << __EOF__
70 From: `basename $0` (backup tape-changing reminder)
71 To: ${recipients}
72 Cc: ${ADMINISTRATOR}
73 Subject: Backup needs new tape for volume ${volno}
74 Reply-To: ${ADMINISTRATOR}
75
76 This is an automated report from the backup script running on
77 `hostname`.
78
79 Volume ${volno} of the backup needs to be put in the tape drive. Usually
80 whoever prepared the backup leaves labeled tapes on top of the drive
81 itself. If there aren't any more, information about where to find tapes
82 and how to label them are posted on the wall by apple-gunkies (unhelpfully
83 obscured by a bookshelf). An online copy (which is probably more
84 up-to-date) can also be found in ~friedman/etc/fsf/backup.how.
85 __EOF__
86
87
88 echo "\aPlease put volume ${volno} in tape drive and press RETURN"
89 read input
90 echo "Writing volume ${volno}..."
91
92 sendmail -oi -t << __EOF__
93 From: `basename $0` (backup tape-changing reminder)
94 To: ${recipients}
95 Cc: ${ADMINISTRATOR}
96 Subject: Volume ${volno} for backup has been added
97 Reply-To: ${ADMINISTRATOR}
98
99 This is an automated report from the backup script running on
100 `hostname`.
101
102 The backup has been continued, so for now no further attention is required.
103 __EOF__
104
105 exit 0
106
107 # eof
This page took 0.038099 seconds and 4 git commands to generate.