dump-remind.in 3.1 KB

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