]> Dogcows Code - chaz/tar/blob - scripts/dump-remind.in
Update copyright years.
[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 # Copyright 2004-2005, 2010, 2012-2014 Free Software Foundation, Inc.
12
13 # This file is part of GNU tar.
14
15 # GNU tar is free software; you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 3 of the License, or
18 # (at your option) any later version.
19
20 # GNU tar is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
24
25 # You should have received a copy of the GNU General Public License
26 # along with this program. If not, see <http://www.gnu.org/licenses/>.
27
28 # Include location of 'sendmail' and GNU finger.
29 PATH="/usr/lib:/usr/local/gnubin:${PATH}"
30 export PATH
31
32 # Load library routines
33 SYSCONFDIR=${SYSCONFDIR-@sysconfdir@}
34 . ${LIBPATH-@libexecdir@}/backup.sh
35
36 MT_REWIND
37 MT_OFFLINE
38
39 # Get a list of people to whom to mail a request for changing the tape.
40 # This egregious nightmare parses the output from GNU finger which shows
41 # which users are logged into consoles (and thus in the office and capable
42 # of changing tapes).
43 #
44 # Certain users (like 'root') aren't real users, and shouldn't be notified.
45 # Neither should 'zippy', 'elvis', etc. (on the GNU machines) since they're
46 # just test accounts.
47 recipients="`
48 finger .clients 2> /dev/null \
49 | sed -ne '
50 1{
51 /clientstatus: file has not changed in/{
52 n;n;n;n;d
53 }
54 n;n;d
55 }
56 s/^..................................................//
57 $!{/^$/d
58 /^root?*$/d
59 /^zippy$/d
60 /^fnord$/d
61 /^elvis$/d
62 /^snurd$/d
63 H
64 }
65 ${g
66 : 1
67 s/\(\n\)\([A-Za-z0-9_][A-Za-z0-9_]*\)\(\n.*\)\2\(.*\)/\1\2\3\4/g
68 s/\n$//g
69 t 1
70 s/^\n//
71 s/\n$//g
72 s/\n/, /g
73 : 2
74 s/, ,/,/g
75 t 2
76 p
77 }'`"
78
79 # Customized behavior for FSF machines, to bring attention to the fact that
80 # the tape needs to be changed (who looks at the terminal?)
81 sendmail -oi -t << __EOF__
82 From: `basename $0` (backup tape-changing reminder)
83 To: ${recipients}
84 Cc: ${ADMINISTRATOR}
85 Subject: Backup needs new tape for volume ${TAR_VOLUME}
86 Reply-To: ${ADMINISTRATOR}
87
88 This is an automated report from the backup script running on
89 `hostname`.
90
91 Volume ${TAR_VOLUME} of the backup needs to be put in the tape drive.
92 Usually whoever prepared the backup leaves labeled tapes on top of the
93 drive itself. If there aren't any more, information about where to find
94 tapes and how to label them are posted on the wall by apple-gunkies
95 (unhelpfully obscured by a bookshelf). An online copy (which is probably
96 more up-to-date) can also be found in ~friedman/etc/fsf/backup.how.
97 __EOF__
98
99
100 echo "\aPlease put volume ${TAR_VOLUME} in tape drive and press RETURN"
101 read input
102 echo "Writing volume ${TAR_VOLUME}..."
103
104 sendmail -oi -t << __EOF__
105 From: `basename $0` (backup tape-changing reminder)
106 To: ${recipients}
107 Cc: ${ADMINISTRATOR}
108 Subject: Volume ${TAR_VOLUME} for backup has been added
109 Reply-To: ${ADMINISTRATOR}
110
111 This is an automated report from the backup script running on
112 `hostname`.
113
114 The backup has been continued, so for now no further attention is required.
115 __EOF__
116
117 exit 0
118
119 # eof
This page took 0.038888 seconds and 4 git commands to generate.