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