From 0273b1ae0945ead45f96ae5b82700d793cd96639 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 6 May 2004 09:14:29 +0000 Subject: [PATCH] Removed --- scripts/dump-remind | 107 ----------------------- scripts/level-0 | 200 ------------------------------------------- scripts/level-1 | 203 -------------------------------------------- scripts/weekly.new | 42 --------- 4 files changed, 552 deletions(-) delete mode 100755 scripts/dump-remind delete mode 100644 scripts/level-0 delete mode 100644 scripts/level-1 delete mode 100755 scripts/weekly.new diff --git a/scripts/dump-remind b/scripts/dump-remind deleted file mode 100755 index d5921d1..0000000 --- a/scripts/dump-remind +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh -# This file is included in the GNU tar distribution as an example. It is -# not used by default unless the proper line is uncommented in backup-specs. -# System administrators will probably want to customize this and -# backup-specs for their site. -# -# This script should be run by tar with --info-script (-F) to inform -# interested parties that a tape for the next volume of the backup needs to -# be put in the tape drive. -# - -# Include location of `sendmail' and GNU finger. -PATH="/usr/lib:/usr/local/gnubin:${PATH}" -export PATH - -# Get definition of TAPE_FILE, VOLNO_FILE, and so on. -. /home/gd2/dump/backup-specs - -mt -f "${TAPE_FILE}" rewind -mt -f "${TAPE_FILE}" offl - -volno="`cat \"${VOLNO_FILE}\" 2> /dev/null`" -if [ $? -ne 0 ]; then - volno=0 -fi - -# Get a list of people to whom to mail a request for changing the tape. -# This egregious nightmare parses the output from GNU finger which shows -# which users are logged into consoles (and thus in the office and capable -# of changing tapes). -# -# Certain users (like `root') aren't real users, and shouldn't be notified. -# Neither should `zippy', `elvis', etc. (on the GNU machines) since they're -# just test accounts. -recipients="` - finger .clients 2> /dev/null \ - | sed -ne ' - 1{ - /clientstatus: file has not changed in/{ - n;n;n;n;d - } - n;n;d - } - s/^..................................................// - $!{/^$/d - /^root?*$/d - /^zippy$/d - /^fnord$/d - /^elvis$/d - /^snurd$/d - H - } - ${g - : 1 - s/\(\n\)\([A-Za-z0-9_][A-Za-z0-9_]*\)\(\n.*\)\2\(.*\)/\1\2\3\4/g - s/\n$//g - t 1 - s/^\n// - s/\n$//g - s/\n/, /g - : 2 - s/, ,/,/g - t 2 - p - }'`" - -# Customized behavior for FSF machines, to bring attention to the fact that -# the tape needs to be changed (who looks at the terminal?) -sendmail -oi -t << __EOF__ -From: `basename $0` (backup tape-changing reminder) -To: ${recipients} -Cc: ${ADMINISTRATOR} -Subject: Backup needs new tape for volume ${volno} -Reply-To: ${ADMINISTRATOR} - -This is an automated report from the backup script running on -`hostname`. - -Volume ${volno} of the backup needs to be put in the tape drive. Usually -whoever prepared the backup leaves labeled tapes on top of the drive -itself. If there aren't any more, information about where to find tapes -and how to label them are posted on the wall by apple-gunkies (unhelpfully -obscured by a bookshelf). An online copy (which is probably more -up-to-date) can also be found in ~friedman/etc/fsf/backup.how. -__EOF__ - - -echo "Please put volume ${volno} in tape drive and press RETURN" -read input -echo "Writing volume ${volno}..." - -sendmail -oi -t << __EOF__ -From: `basename $0` (backup tape-changing reminder) -To: ${recipients} -Cc: ${ADMINISTRATOR} -Subject: Volume ${volno} for backup has been added -Reply-To: ${ADMINISTRATOR} - -This is an automated report from the backup script running on -`hostname`. - -The backup has been continued, so for now no further attention is required. -__EOF__ - -exit 0 - -# eof diff --git a/scripts/level-0 b/scripts/level-0 deleted file mode 100644 index 734d9e4..0000000 --- a/scripts/level-0 +++ /dev/null @@ -1,200 +0,0 @@ -#!/bin/sh -# -# Run this script as root on the machine that has the tape drive, to make a -# full (level-0) dump. -# -# If you give `now' as an argument, the dump is done immediately. -# Otherwise, it waits until 1am, or until the hour given as argument. -# Specify the hour as a number from 0 to 23. -# -# You must edit the file `backup-specs' to set the parameters for your site. - -# Useful for backup-specs, in case things have to be done slightly -# differently for different dump levels. -DUMP_LEVEL=0 - -# Insure `mail' is in PATH. -PATH="/usr/ucb:${PATH}" -export PATH - -# This is not the most reliable test in the world. The following might be -# more predictable: -# -# whoami="`whoami`" -# euid="`sed -ne '/^'\"${whoami}\"':/{s/^[^:]*:[^:]*://;s/:.*//p;q;}' /etc/passwd`" -# if [ "${euid}" != 0 ]; then ... -# -if [ ! -w / ]; then - echo "The backup must be run as root or else some files will fail to be dumped." - exit 1 -fi - -# Get the values of BACKUP_DIRS, BACKUP_FILES, and other variables. -. ./backup-specs - -# Maybe sleep until around specified or default hour. -if [ "${1}" != "now" ]; then - if [ "${1}x" != "x" ]; then - spec="${1}" - else - spec="${BACKUP_HOUR}" - fi - - pausetime="`date | awk ' - { - hr = substr($4, 1, 2); - mn = substr($4, 4, 2); - if((hr + 0) < (spec + 0)) - print 3600 * (spec - hr) - 60 * mn; - else - print 3600 * (spec + (24 - hr)) - 60 * mn; - }' spec=\"${spec}\"`" - - clear - echo "${SLEEP_MESSAGE}" - sleep "${pausetime}" -fi - -# start doing things - -# Put startdate in the subject line of mailed report, since if it happens -# to run longer than 24 hours (as may be the case if someone forgets to put -# in the next volume of the tape in adequate time), the backup date won't -# appear too misleading. -startdate="`date`" - -here="`pwd`" - -# Logfile name should be in the form ``log-1993-03-18-level-0'' -# They go in the subdirectory `log' of the current directory. -# i.e. year-month-date. This format is useful for sorting by name, since -# logfiles are intentionally kept online for future reference. -LOGFILE="log/log-`date | sed -ne ' - s/[^ ]* *\([^ ]*\) *\([^ ]*\).* \([^ ]*\)$/\3-\1-\2/ - /-[0-9]$/s/\([0-9]\)$/0\1/ - /Jan/{s/Jan/01/p;q;} - /Feb/{s/Feb/02/p;q;} - /Mar/{s/Mar/03/p;q;} - /Apr/{s/Apr/04/p;q;} - /May/{s/May/05/p;q;} - /Jun/{s/Jun/06/p;q;} - /Jul/{s/Jul/07/p;q;} - /Aug/{s/Aug/08/p;q;} - /Sep/{s/Sep/09/p;q;} - /Oct/{s/Oct/10/p;q;} - /Nov/{s/Nov/11/p;q;} - /Dec/{s/Dec/12/p;q;}'`-level-${DUMP_LEVEL}" - -localhost="`hostname | sed -e 's/\..*//'`" - -TAR_PART1="${TAR} -c --multi-volume --one-file-system --blocking=${BLOCKING} --sparse --volno-file=${VOLNO_FILE}" - -# Only use --info-script if DUMP_REMIND_SCRIPT was defined in backup-specs -if [ "x${DUMP_REMIND_SCRIPT}" != "x" ]; then - TAR_PART1="${TAR_PART1} --info-script='${DUMP_REMIND_SCRIPT}'" -fi - -# Make sure the log file did not already exist. Create it. - -if [ -f "${LOGFILE}" ] ; then - echo "Log file ${LOGFILE} already exists." 1>&2 - exit 1 -else - touch "${LOGFILE}" -fi - -# Most everything below here is run in a subshell for which all output is -# piped through `tee' to the logfile. Doing this, instead of having -# multiple pipelines all over the place, is cleaner and allows access to -# the exit value from various commands more easily. -( - # Caveat: Some version of `mt' require `-t', not `-f'. - mt -f "${TAPE_FILE}" rewind - rm -f "${VOLNO_FILE}" - - set - ${BACKUP_DIRS} - while [ $# -ne 0 ] ; do - date="`date`" - remotehost="`echo \"${1}\" | sed -e 's/:.*$//'`" - fs="`echo \"${1}\" | sed -e 's/^.*://'`" - fsname="`echo \"${1}\" | sed -e 's/\//:/g'`" - - # This filename must be absolute; it is opened on the machine that runs tar. - TAR_PART2="--listed=/etc/tar-backup/temp.level-0" - TAR_PART3="--label='Full backup of ${fs} on ${remotehost} at ${date}' -C ${fs} ." - - echo "Backing up ${1} at ${date}" - - # Actually back things up. - - if [ "z${localhost}" != "z${remotehost}" ] ; then - rsh "${remotehost}" mkdir /etc/tar-backup > /dev/null 2>&1 - rsh "${remotehost}" rm -f /etc/tar-backup/temp.level-0 - rsh "${remotehost}" ${TAR_PART1} -f "${localhost}:${TAPE_FILE}" ${TAR_PART2} ${TAR_PART3} - else - mkdir /etc/tar-backup > /dev/null 2>&1 - rm -f /etc/tar-backup/temp.level-0 - # Using `sh -c exec' causes nested quoting and shell substitution - # to be handled here in the same way rsh handles it. - sh -c "exec ${TAR_PART1} -f \"${TAPE_FILE}\" ${TAR_PART2} ${TAR_PART3}" - fi - - # `rsh' doesn't exit with the exit status of the remote command. What - # stupid lossage. TODO: think of a reliable workaround. - if [ $? -ne 0 ] ; then - echo "Backup of ${1} failed." 1>&2 - # I'm assuming that the tar will have written an empty - # file to the tape, otherwise I should do a cat here. - else - if [ "z${localhost}" != "z${remotehost}" ] ; then - rsh "${remotehost}" mv -f /etc/tar-backup/temp.level-0 "/etc/tar-backup/${fsname}.level-0" - else - mv -f /etc/tar-backup/temp.level-0 "/etc/tar-backup/${fsname}.level-0" - fi - fi - ${TAPE_STATUS} - sleep 60 - shift - done - - # Dump any individual files requested. - - if [ "x${BACKUP_FILES}" != "x" ] ; then - date="`date`" - - TAR_PART2="--listed=/etc/tar-backup/temp.level-0" - TAR_PART3="--label='Full backup of miscellaneous files at ${date}'" - - mkdir /etc/tar-backup > /dev/null 2>&1 - rm -f /etc/tar-backup/temp.level-0 - - echo "Backing up miscellaneous files at ${date}" - - # Using `sh -c exec' causes nested quoting and shell substitution - # to be handled here in the same way rsh handles it. - sh -c "exec ${TAR_PART1} -f \"${TAPE_FILE}\" ${TAR_PART2} ${TAR_PART3} ${BACKUP_FILES}" - - # `rsh' doesn't exit with the exit status of the remote command. What - # lossage. TODO: think of a reliable workaround. - if [ $? -ne 0 ] ; then - echo "Backup of miscellaneous files failed." - # I'm assuming that the tar will have written an empty - # file to the tape, otherwise I should do a cat here. - else - mv -f /etc/tar-backup/temp.level-0 /etc/tar-backup/misc.level-0 - fi - ${TAPE_STATUS} - else - echo "No miscellaneous files specified" - fi - - # Caveat: some versions of `mt' use `-t' instead of `-f'. - mt -f "${TAPE_FILE}" rewind - mt -f "${TAPE_FILE}" offl - -) 2>&1 | tee -a "${LOGFILE}" - -echo "Sending the dump log to ${ADMINISTRATOR}" -mail -s "Results of backup started ${startdate}" ${ADMINISTRATOR} < "${LOGFILE}" - -# eof diff --git a/scripts/level-1 b/scripts/level-1 deleted file mode 100644 index d7f3e0b..0000000 --- a/scripts/level-1 +++ /dev/null @@ -1,203 +0,0 @@ -#!/bin/sh -# -# Run this script as root on the machine that has the tape drive, to make a -# level-1 dump containing all files changed since the last full dump. -# -# If you give `now' as an argument, the dump is done immediately. -# Otherwise, it waits until 1am. -# -# You must edit the file `backup-specs' to set the parameters for your site. - -# Useful for backup-specs, in case things have to be done slightly -# differently for different dump levels. -DUMP_LEVEL=1 - -# Insure `mail' is in PATH. -PATH="/usr/ucb:${PATH}" -export PATH - -# This is not the most reliable test in the world. The following might be -# more predictable: -# -# whoami="`whoami`" -# euid="`sed -ne '/^'\"${whoami}\"':/{s/^[^:]*:[^:]*://;s/:.*//p;q;}' /etc/passwd`" -# if [ "${euid}" != 0 ]; then ... -# -if [ ! -w / ]; then - echo "The backup must be run as root or else some files will fail to be dumped." - exit 1 -fi - -# Get the values of BACKUP_DIRS, BACKUP_FILES, and other variables. -. ./backup-specs - -# Maybe sleep until around specified or default hour. -if [ "z${1}" != "znow" ]; then - if [ "${1}x" != "x" ]; then - spec="${1}" - else - spec="${BACKUP_HOUR}" - fi - - pausetime="`date | awk ' - { - hr = substr($4, 1, 2); - mn = substr($4, 4, 2); - if((hr + 0) < (spec + 0)) - print 3600 * (spec - hr) - 60 * mn; - else - print 3600 * (spec + (24 - hr)) - 60 * mn; - }' spec=\"${spec}\"`" - - clear - echo "${SLEEP_MESSAGE}" - sleep "${pausetime}" -fi - -# start doing things - -# Put startdate in the subject line of mailed report, since if it happens -# to run longer than 24 hours (as may be the case if someone forgets to put -# in the next volume of the tape in adequate time), the backup date won't -# appear too misleading. -startdate="`date`" - -here="`pwd`" - -# Logfile name should be in the form ``log-1993-03-18-level-1'' -# They go in the subdirectory `log' of the current directory. -# i.e. year-month-date. This format is useful for sorting by name, since -# logfiles are intentionally kept online for future reference. -LOGFILE="log/log-`date | sed -ne ' - s/[^ ]* *\([^ ]*\) *\([^ ]*\).* \([^ ]*\)$/\3-\1-\2/ - /-[0-9]$/s/\([0-9]\)$/0\1/ - /Jan/{s/Jan/01/p;q;} - /Feb/{s/Feb/02/p;q;} - /Mar/{s/Mar/03/p;q;} - /Apr/{s/Apr/04/p;q;} - /May/{s/May/05/p;q;} - /Jun/{s/Jun/06/p;q;} - /Jul/{s/Jul/07/p;q;} - /Aug/{s/Aug/08/p;q;} - /Sep/{s/Sep/09/p;q;} - /Oct/{s/Oct/10/p;q;} - /Nov/{s/Nov/11/p;q;} - /Dec/{s/Dec/12/p;q;}'`-level-${DUMP_LEVEL}" - -localhost="`hostname | sed -e 's/\..*//'`" - -TAR_PART1="${TAR} -c --multi-volume --one-file-system --blocking=${BLOCKING} --sparse --volno-file=${VOLNO_FILE}" - -# Only use --info-script if DUMP_REMIND_SCRIPT was defined in backup-specs -if [ "x${DUMP_REMIND_SCRIPT}" != "x" ]; then - TAR_PART1="${TAR_PART1} --info-script='${DUMP_REMIND_SCRIPT}'" -fi - -# Make sure the log file did not already exist. Create it. - -if [ -f "${LOGFILE}" ] ; then - echo "Log file ${LOGFILE} already exists." 1>&2 - exit 1 -else - touch "${LOGFILE}" -fi - -# Most everything below here is run in a subshell for which all output is -# piped through `tee' to the logfile. Doing this, instead of having -# multiple pipelines all over the place, is cleaner and allows access to -# the exit value from various commands more easily. -( - # Caveat: Some version of `mt' require `-t', not `-f'. - mt -f "${TAPE_FILE}" rewind - rm -f "${VOLNO_FILE}" - - set - ${BACKUP_DIRS} - while [ $# -ne 0 ] ; do - date="`date`" - remotehost="`echo \"${1}\" | sed -e 's/:.*$//'`" - fs="`echo \"${1}\" | sed -e 's/^.*://'`" - fsname="`echo \"${1}\" | sed -e 's/\//:/g'`" - - # This filename must be absolute; it is opened on the machine that runs tar. - TAR_PART2="--listed=/etc/tar-backup/temp.level-1" - TAR_PART3="--label='level 1 backup of ${fs} on ${remotehost} at ${date}' -C ${fs} ." - - echo "Backing up ${1} at ${date}" - echo "Last full dump on this filesystem:" - - if [ "z${remotehost}" != "z${localhost}" ] ; then - rsh "${remotehost}" "ls -l /etc/tar-backup/${fsname}.level-0; \ - cp /etc/tar-backup/${fsname}.level-0 /etc/tar-backup/temp.level-1" - else - ls -l "/etc/tar-backup/${fsname}.level-0" - cp "/etc/tar-backup/${fsname}.level-0" /etc/tar-backup/temp.level-1 - fi - - # Actually back things up. - - if [ "z${remotehost}" != "z${localhost}" ] ; then - rsh "${remotehost}" ${TAR_PART1} -f "${localhost}:${TAPE_FILE}" ${TAR_PART2} ${TAR_PART3} - else - # Using `sh -c exec' causes nested quoting and shell substitution - # to be handled here in the same way rsh handles it. - sh -c "exec ${TAR_PART1} -f \"${TAPE_FILE}\" ${TAR_PART2} ${TAR_PART3}" - fi - - # `rsh' doesn't exit with the exit status of the remote command. What - # stupid lossage. TODO: think of a reliable workaround. - if [ $? -ne 0 ] ; then - echo "Backup of ${1} failed." - # I'm assuming that the tar will have written an empty - # file to the tape, otherwise I should do a cat here. - else - if [ "z${localhost}" != "z${remotehost}" ] ; then - rsh "${remotehost}" mv -f /etc/tar-backup/temp.level-1 "/etc/tar-backup/${fsname}.level-1" - else - mv -f /etc/tar-backup/temp.level-1 "/etc/tar-backup/${fsname}.level-1" - fi - fi - ${TAPE_STATUS} - sleep 60 - shift - done - - # Dump any individual files requested. - - if [ "x${BACKUP_FILES}" != "x" ] ; then - date="`date`" - TAR_PART2="--listed=/etc/tar-backup/temp.level-1" - TAR_PART3="--label='Incremental backup of miscellaneous files at ${date}'" - - echo "Backing up miscellaneous files at ${date}" - echo "Last full dump of these files:" - ls -l /etc/tar-backup/misc.level-0 - - rm -f /etc/tar-backup/temp.level-1 - cp /etc/tar-backup/misc.level-0 /etc/tar-backup/temp.level-1 - - # Using `sh -c exec' causes nested quoting and shell substitution - # to be handled here in the same way rsh handles it. - sh -c "exec ${TAR_PART1} -f \"${TAPE_FILE}\" ${TAR_PART2} ${TAR_PART3} ${BACKUP_FILES}" - - if [ $? -ne 0 ] ; then - echo "Backup of miscellaneous files failed." 1>&2 - # I'm assuming that the tar will have written an empty - # file to the tape, otherwise I should do a cat here. - else - mv -f /etc/tar-backup/temp.level-1 /etc/tar-backup/misc.level-1 - fi - ${TAPE_STATUS} - else - echo "No miscellaneous files specified" - fi - - # Caveat: some versions of `mt' use `-t' instead of `-f'. - mt -f "${TAPE_FILE}" rewind - mt -f "${TAPE_FILE}" offl - -) 2>&1 | tee -a "${LOGFILE}" - -echo "Sending the dump log to ${ADMINISTRATOR}" -mail -s "Results of backup started ${startdate}" ${ADMINISTRATOR} < "${LOGFILE}" - -# eof diff --git a/scripts/weekly.new b/scripts/weekly.new deleted file mode 100755 index d3e87df..0000000 --- a/scripts/weekly.new +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# start doing things -TOBACKUP="albert:/" - -HOST=`hostname | sed 's/\..*//'` -TAPEFILE=/dev/rfd0a -LOGFILE=tar-out -BLOCKING=20 -TAR_PART1="/usr/local/bin/tar clbfVM $BLOCKING" - -rm -f $LOGFILE - -mt -f $TAPEFILE rewind - - host=`echo $TOBACKUP | sed 's/:.*$//'`; - fs=`echo $TOBACKUP | sed 's/^.*://'`; - date=`date`; - fsname=`echo $TOBACKUP | sed 's/\//:/g'` - - TAR_PART2="'Weekly backup of $fs on $host at $date' -C $fs ." - echo Backing up $TOBACKUP at $date | tee -a $LOGFILE - - # Actually back things up. - - if [ $HOST != $host ] ; then - rsh $host $TAR_PART1 $HOST:$TAPEFILE $TAR_PART2 - else - sh -c "exec $TAR_PART1 $TAPEFILE $TAR_PART2" - fi - if [ $? -ne 0 ] ; then - echo Backup of $TOBACKUP failed. | tee -a $LOGFILE - echo mts at time of failure | tee -a $LOGFILE - mts -t $TAPEFILE | tee -a $LOGFILE - # I'm assuming that the tar will have written an empty - # file to the tape, otherwise I should do a cat here. - else - echo $date > $fsname.lasttar - fi - sleep 60; - -mt -f $TAPEFILE rewind -mt -f $TAPEFILE offl -- 2.45.2