From 000f3f87bab07adbb80c7f67f11e7a984b0f3a92 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Tue, 21 Oct 2008 12:03:29 +0200 Subject: [PATCH] clean up noise --- example/amanda.conf | 732 +++++++++++++++++++++++++++++++++++++++++ server-src/amdump.sh | 225 +++++++++++++ server-src/amverify.sh | 565 +++++++++++++++++++++++++++++++ 3 files changed, 1522 insertions(+) create mode 100644 example/amanda.conf create mode 100644 server-src/amdump.sh create mode 100644 server-src/amverify.sh diff --git a/example/amanda.conf b/example/amanda.conf new file mode 100644 index 0000000..61316b5 --- /dev/null +++ b/example/amanda.conf @@ -0,0 +1,732 @@ +# amanda.conf - sample Amanda configuration file. See amanda.conf(5) for +# details + +org "DailySet1" # your organization name for reports +mailto "martinea" # space separated list of operators at your site +dumpuser "martinea" # the user to run dumps under + +inparallel 4 # maximum dumpers that will run in parallel (max 63) + # this maximum can be increased at compile-time, + # modifying MAX_DUMPERS in server-src/driverio.h +dumporder "sssS" # specify the priority order of each dumper + # s -> smallest size + # S -> biggest size + # t -> smallest time + # T -> biggest time + # b -> smallest bandwitdh + # B -> biggest bandwitdh + # try "BTBTBTBTBTBT" if you are not holding + # disk constrained + +taperalgo first # The algorithm used to choose which dump image to send + # to the taper. + # Possible values: + # [first|firstfit|largest|largestfit|smallest|last] + # Default: first. + # first First in - first out. + # firstfit The first dump image that will fit + # on the current tape. + # largest The largest dump image. + # largestfit The largest dump image that will fit + # on the current tape. + # smallest The smallest dump image. + # last Last in - first out. + +displayunit "k" # Possible values: "k|m|g|t" + # Default: k. + # The unit used to print many numbers. + # k=kilo, m=mega, g=giga, t=tera + +netusage 8000 Kbps # maximum net bandwidth for Amanda, in KB per sec + +dumpcycle 4 weeks # the number of days in the normal dump cycle +runspercycle 20 # the number of amdump runs in dumpcycle days + # (4 weeks * 5 amdump runs per week -- just weekdays) +tapecycle 25 tapes # the number of tapes in rotation + # 4 weeks (dumpcycle) times 5 tapes per week (just + # the weekdays) plus a few to handle errors that + # need amflush and so we do not overwrite the full + # backups performed at the beginning of the previous + # cycle + +bumpsize 20 Mb # minimum savings (threshold) to bump level 1 -> 2 +bumppercent 20 # minimum savings (threshold) to bump level 1 -> 2 +bumpdays 1 # minimum days at each level +bumpmult 4 # threshold = bumpsize * bumpmult^(level-1) + +etimeout 300 # number of seconds per filesystem for estimates. +dtimeout 1800 # number of idle seconds before a dump is aborted. +ctimeout 30 # maximum number of seconds that amcheck waits + # for each client host + +device_output_buffer_size 1280k + # amount of buffer space to use when writing to devices + +# By default, Amanda can only track at most one run per calendar day. When +# the usetimestamps option is enabled, however, Amanda can track as many +# runs as you care to make. +# WARNING: This option is not backward-compatible. Do not enable it if you +# intend to downgrade your server installation to Amanda community +# edition 2.5 +usetimestamps yes + +# flush-threshold-dumped, flush-threshold-scheduled, taperflush, and autoflush +# are used to control tape utilization. See the amanda.conf (5) manpage for +# details on how they work. Taping will not start until all criteria are +# satisfied. Here are some examples: +# +# You want to fill tapes completely even in the case of failed dumps, and +# don't care if some dumps are left on the holding disk after a run: +# flush-threshold-dumped 100 # (or more) +# flush-threshold-scheduled 100 # (or more) +# taperflush 100 +# autoflush yes +# +# You want to improve tape performance by waiting for a complete tape of data +# before writing anything. However, all dumps will be flushed; none will +# be left on the holding disk. +# flush-threshold-dumped 100 # (or more) +# flush-threshold-scheduled 100 # (or more) +# taperflush 0 +# +# You don't want to use a new tape for every run, but want to start writing +# to tape as soon as possible: +# flush-threshold-dumped 0 # (or more) +# flush-threshold-scheduled 100 # (or more) +# taperflush 100 +# autoflush yes +# maxdumpsize 100k # amount of data to dump each run; see above. +# +# You want to keep the most recent dumps on holding disk, for faster recovery. +# Older dumps will be rotated to tape during each run. +# flush-threshold-dumped 300 # (or more) +# flush-threshold-scheduled 300 # (or more) +# taperflush 300 +# autoflush yes +# +# Defaults: +# (no restrictions; flush to tape immediately; don't flush old dumps.) +flush-threshold-dumped 0 +flush-threshold-scheduled 0 +taperflush 0 +autoflush no + +# Specify tape device and/or tape changer. If you don't have a tape +# changer, and you don't want to use more than one tape per run of +# amdump, just comment out the definition of tpchanger. + +# Some tape changers require tapedev to be defined; others will use +# their own tape device selection mechanism. Some use a separate tape +# changer device (changerdev), others will simply ignore this +# parameter. Some rely on a configuration file (changerfile) to +# obtain more information about tape devices, number of slots, etc; +# others just need to store some data in files, whose names will start +# with changerfile. + +# At most one changerfile entry must be defined; select the most +# appropriate one for your configuration. If you select man-changer, +# keep the first one; if you decide not to use a tape changer, you may +# comment them all out. + +runtapes 1 # number of tapes to be used in a single run of amdump +tpchanger "chg-manual" # the tape-changer glue script +tapedev "tape:/dev/YOUR-TAPE-DEVICE-HERE" # the no-rewind tape device to be used + +#changerfile "/etc/amanda/DailySet1/changer" +#changerfile "/etc/amanda/DailySet1/changer-status" +changerfile "/etc/amanda/DailySet1/changer.conf" +changerdev "/dev/null" + +# If you want Amanda to automatically label any non-Amanda tapes it +# encounters, uncomment the line below. Note that this will ERASE any +# non-Amanda tapes you may have, and may also ERASE any near-failing tapes. +# Use with caution. +## label_new_tapes "DailySet1-%%%" + +maxdumpsize -1 # Maximum number of bytes the planner will schedule + # for a run (default: runtapes * tape_length). +tapetype HP-DAT # what kind of tape it is (see tapetypes below) +labelstr "^DailySet1-[0-9][0-9]*$" # label constraint regex: all tapes must match + +amrecover_do_fsf yes # amrecover will call amrestore with the + # -f flag for faster positioning of the tape. +amrecover_check_label yes # amrecover will call amrestore with the + # -l flag to check the label. +amrecover_changer "changer" # amrecover will use the changer if you restore + # from this device. It could be a string like 'changer' and amrecover will use your + # changer if you set your tape to 'changer' with 'setdevice changer' or via + # 'tapedev "changer"' in amanda-client.conf + +# Specify holding disks. These are used as a temporary staging area for +# dumps before they are written to tape and are recommended for most sites. +# The advantages include: tape drive is more likely to operate in streaming +# mode (which reduces tape and drive wear, reduces total dump time); multiple +# dumps can be done in parallel (which can dramatically reduce total dump time. +# The main disadvantage is that dumps on the holding disk need to be flushed +# (with amflush) to tape after an operating system crash or a tape failure. +# If no holding disks are specified then all dumps will be written directly +# to tape. If a dump is too big to fit on the holding disk than it will be +# written directly to tape. If more than one holding disk is specified then +# they will all be used based on activity and available space. + +holdingdisk hd1 { + comment "main holding disk" + directory "/dumps/amanda" # where the holding disk is + use -100 Mb # how much space can we use on it + # a non-positive value means: + # use all space but that value + chunksize 1Gb # size of chunk if you want big dump to be + # dumped on multiple files on holding disks + # N Kb/Mb/Gb split images in chunks of size N + # The maximum value should be + # (MAX_FILE_SIZE - 1Mb) + # 0 same as INT_MAX bytes + } +#holdingdisk hd2 { +# directory "/dumps2/amanda" +# use 1000 Mb +# } +#holdingdisk hd3 { +# directory "/mnt/disk4" +# use 1000 Mb +# } + + +# If amanda cannot find a tape on which to store backups, it will run +# as many backups as it can to the holding disks. In order to save +# space for unattended backups, by default, amanda will only perform +# incremental backups in this case, i.e., it will reserve 100% of the +# holding disk space for the so-called degraded mode backups. +# However, if you specify a different value for the `reserve' +# parameter, amanda will not degrade backups if they will fit in the +# non-reserved portion of the holding disk. + +# reserve 30 # percent +# This means save at least 30% of the holding disk space for degraded +# mode backups. + +# The format for a ColumnSpec is a ',' seperated list of triples. +# Each triple consists of +# + the name of the column (as in ColumnNameStrings) +# + prefix before the column +# + the width of the column, if set to -1 it will be recalculated +# to the maximum length of a line to print. +# Example: +# "Disk=1:17,HostName=1:10,OutKB=1:7" +# or +# "Disk=1:-1,HostName=1:10,OutKB=1:7" +# +# You need only specify those colums that should be changed from +# the default. If nothing is specified in the configfile, the +# above compiled in values will be in effect, resulting in an +# output as it was all the time. +# The names of the colums are: +# HostName, Disk, Level, OrigKB, OutKB, Compress, DumpTime, DumpRate, +# TapeTime and TapeRate. +# ElB, 1999-02-24. +# columnspec "Disk=1:18,HostName=0:10,OutKB=1:7" + + +# Amanda needs a few Mb of diskspace for the log and debug files, +# as well as a database. This stuff can grow large, so the conf directory +# isn't usually appropriate. Some sites use /usr/local/var and some /usr/adm. +# Create an amanda directory under there. You need a separate infofile and +# logdir for each configuration, so create subdirectories for each conf and +# put the files there. Specify the locations below. + +# Note that, although the keyword below is infofile, it is only so for +# historic reasons, since now it is supposed to be a directory (unless +# you have selected some database format other than the `text' default) +infofile "/etc/amanda/DailySet1/curinfo" # database DIRECTORY +logdir "/etc/amanda/DailySet1" # log directory +indexdir "/etc/amanda/DailySet1/index" # index directory +#tapelist "/etc/amanda/DailySet1/tapelist" # list of used tapes +# tapelist is stored, by default, in the directory that contains amanda.conf + +# tapetypes + +# Define the type of tape you use here, and use it in "tapetype" +# above. Some typical types of tapes are included here. The tapetype +# tells amanda how many MB will fit on the tape, how big the filemarks +# are, and how fast the tape device is. + +# A filemark is the amount of wasted space every time a tape section +# ends. If you run `make tapetype' in tape-src, you'll get a program +# that generates tapetype entries, but it is slow as hell, use it only +# if you really must and, if you do, make sure you post the data to +# the amanda mailing list, so that others can use what you found out +# by searching the archives. + +# For completeness Amanda should calculate the inter-record gaps too, +# but it doesn't. For EXABYTE and DAT tapes this is ok. Anyone using +# 9 tracks for amanda and need IRG calculations? Drop me a note if +# so. + +# If you want amanda to print postscript paper tape labels +# add a line after the comment in the tapetype of the form +# lbl-templ "/path/to/postscript/template/label.ps" + +# if you want the label to go to a printer other than the default +# for your system, you can also add a line above for a different +# printer. (i usually add that line after the dumpuser specification) + +# dumpuser "operator" # the user to run dumps under +# printer "mypostscript" # printer to print paper label on + +# here is an example of my definition for an EXB-8500 + +# define tapetype EXB-8500 { +# ... +# lbl-templ "/etc/amanda/config/lbl.exabyte.ps" +# } + + +define tapetype QIC-60 { + comment "Archive Viper" + length 60 mbytes + filemark 100 kbytes # don't know a better value + speed 100 kbytes # dito +} + +define tapetype DEC-DLT2000 { + comment "DEC Differential Digital Linear Tape 2000" + length 15000 mbytes + filemark 8 kbytes + speed 1250 kbytes +} + +# goluboff@butch.Colorado.EDU +# in amanda-users (Thu Dec 26 01:55:38 MEZ 1996) +define tapetype DLT { + comment "DLT tape drives" + length 20000 mbytes # 20 Gig tapes + filemark 2000 kbytes # I don't know what this means + speed 1536 kbytes # 1.5 Mb/s +} + +define tapetype SURESTORE-1200E { + comment "HP AutoLoader" + length 3900 mbytes + filemark 100 kbytes + speed 500 kbytes +} + +define tapetype EXB-8500 { + comment "Exabyte EXB-8500 drive on decent machine" + length 4200 mbytes + filemark 48 kbytes + speed 474 kbytes +} + +define tapetype EXB-8200 { + comment "Exabyte EXB-8200 drive on decent machine" + length 2200 mbytes + filemark 2130 kbytes + speed 240 kbytes +} + +define tapetype HP-DAT { + comment "DAT tape drives" + # data provided by Rob Browning + length 1930 mbytes + filemark 111 kbytes + speed 468 kbytes +} + +define tapetype DAT { + comment "DAT tape drives" + length 1000 mbytes # these numbers are not accurate + filemark 100 kbytes # but you get the idea + speed 100 kbytes +} + +define tapetype MIMSY-MEGATAPE { + comment "Megatape (Exabyte based) drive through Emulex on Vax 8600" + length 2200 mbytes + filemark 2130 kbytes + speed 170 kbytes # limited by the Emulex bus interface, ugh +} + +define tapetype SEAGATE-ULTRIUM-LTO { + comment "SEAGATE ULTRIUM 06242 LTO, compression off" + length 99584 mbytes + filemark 0 kbytes + speed 11288 kps +} + +# dumptypes +# +# These are referred to by the disklist file. The dumptype specifies +# certain parameters for dumping including: +# auth - authentication scheme to use between server and client. +# Valid values are "bsd", "krb4", "krb5" and "ssh". +# Default: [auth bsd] +# comment - just a comment string +# comprate - set default compression rate. Should be followed by one or +# two numbers, optionally separated by a comma. The 1st is +# the full compression rate; the 2nd is the incremental rate. +# If the second is omitted, it is assumed equal to the first. +# The numbers represent the amount of the original file the +# compressed file is expected to take up. +# Default: [comprate 0.50, 0.50] +# compress - specify compression of the backed up data. Valid values are: +# "none" - don't compress the dump output. +# "client best" - compress on the client using the best (and +# probably slowest) algorithm. +# "client fast" - compress on the client using fast algorithm. +# "client custom" - compress using your custom client compression program. +# use client_custom_compress "PROG" to specify +# the custom compression program. +# PROG must not contain white space. +# "server best" - compress on the tape host using the best (and +# probably slowest) algorithm. +# "server fast" - compress on the tape host using a fast +# algorithm. This may be useful when a fast +# tape host is backing up slow clients. +# "server custom" - compress using your server custom compression program. +# use server_custom_compress "PROG" to specify +# the custom compression program. +# PROG must not contain white space. +# Default: [compress client fast] +# dumpcycle - set the number of days in the dump cycle, ie, set how often a +# full dump should be performed. Default: from DUMPCYCLE above +# estimate Determine the way AMANDA does it's estimate. +# "client" - Use the same program as the dumping program, +# this is the most accurate way to do estimates, +# but it can take a long time. +# "calcsize" - Use a faster program to do estimates, but the +# result is less accurate. +# "server" - Use only statistics from the previous run to +# give an estimate, +# it takes only a few seconds but the result is not +# accurate if your disk usage changes from day to day. +# Default: [client] +# encrypt - specify encryption of the backed up data. Valid values are: +# "none" - don't encrypt the dump output. +# "client" - encrypt on the client using the program specified by +# client_encrypt "PROG". +# Use client_decrypt_option to specify the decrypt- +# parameter, default is "-d". +# PROG and decrypt-parameter must not contain white space. +# "server" - encrypt on the server using the program specified by +# server_encrypt "PROG". +# Use server_decrypt_option to specify the decrypt- +# parameter, default is "-d". +# PROG and decrypt-parameter must not contain white space. +# Default: [none] +# exclude - specify files and directories to be excluded from the dump. +# Useful with gnutar only; silently ignored by dump and samba. +# Valid values are: +# "pattern" - a shell glob pattern defining which files +# to exclude. +# gnutar gets --exclude="pattern" +# list "filename" - a file (on the client!) containing patterns +# re's (1 per line) defining which files to +# exclude. +# gnutar gets --exclude-from="filename" +# Note that the `full pathname' of a file within its +# filesystem starts with `./', because of the way amanda runs +# gnutar: `tar -C $mountpoint -cf - --lots-of-options .' (note +# the final dot!) Thus, if you're backing up `/usr' with a +# diskfile entry like ``host /usr gnutar-root', but you don't +# want to backup /usr/tmp, your exclude list should contain +# the pattern `./tmp', as this is relative to the `/usr' above. +# Please refer to the man-page of gnutar for more information. +# If a relative pathname is specified as the exclude list, +# it is searched from within the directory that is +# going to be backed up. +# Default: include all files +# holdingdisk - should the holding disk be used for this dump. Useful for +# dumping the holding disk itself. Default: [holdingdisk auto] +# "never" - Never use the holding disk. +# "auto" - Use the holding disk if possible. +# "required" - Always use the holding disk. +# ignore - do not back this filesystem up. Useful for sharing a single +# disklist in several configurations. +# index - keep an index of the files backed up. Default: [index no] +# kencrypt - encrypt the data stream between the client and server. +# Default: [kencrypt no] +# maxdumps - max number of concurrent dumps to run on the client. +# Default: [maxdumps 1] +# maxpromoteday - max number of day for a promotion, set it 0 if you don't +# want promotion, set it to 1 or 2 if your disk get +# overpromoted. +# Default: [10000] +# priority - priority level of the dump. Valid levels are "low", "medium" +# or "high". These are really only used when Amanda has no +# tape to write to because of some error. In that "degraded +# mode", as many incrementals as will fit on the holding disk +# are done, higher priority first, to insure the important +# disks are at least dumped. Default: [priority medium] +# program - specify the dump system to use. Valid values are "DUMP", +# or "GNUTAR". Default: [program "DUMP"]. +# record - record the backup in the time-stamp-database of the backup +# program (e.g. /etc/dumpdates for DUMP or +# @GNUTAR_LISTED_INCREMENTAL_DIRX@ for GNUTAR.). +# Default: [record yes] +# skip-full - skip the disk when a level 0 is due, to allow full backups +# outside Amanda, eg when the machine is in single-user mode. +# skip-incr - skip the disk when the level 0 is NOT due. This is used in +# archive configurations, where only full dumps are done and +# the tapes saved. +# starttime - delay the start of the dump? Default: no delay +# strategy - set the dump strategy. Valid strategies are currently: +# "standard" - the standard one. +# "nofull" - do level 1 dumps every time. This can be used, +# for example, for small root filesystems that +# only change slightly relative to a site-wide +# prototype. Amanda then backs up just the +# changes. +# "noinc" - do level 0 dumps every time. +# "skip" - skip all dumps. Useful for sharing a single +# disklist in several configurations. +# "incronly" - do only incremental dumps. This is similar +# to strategy 'nofull', but will increase +# the dump level as usual. Full dumps will +# only be performed when an 'amadmin force' +# has been issued +# Default: [strategy standard] +# tape_splitsize - (optional) split dump file into pieces of a specified size. +# This allows dumps to be spread across multiple tapes, and can +# potentially make more efficient use of tape space. Note that +# if this value is too large (more than half the size of the +# average dump being split), substantial tape space can be +# wasted. If too small, large dumps will be split into +# innumerable tiny dumpfiles, adding to restoration complexity. +# A good rule of thumb, usually, is 1/10 of the size of your +# tape. Default: [disabled] +# split_diskbuffer - (optional) When dumping a split dump in PORT-WRITE +# mode (usually meaning "no holding disk"), buffer the split +# chunks to a file in the directory specified by this option. +# Default: [none] +# fallback_splitsize - (optional) When dumping a split dump in PORT-WRITE +# mode, if no split_diskbuffer is specified (or if we somehow +# fail to use our split_diskbuffer), we must buffer split +# chunks in memory. This specifies the maximum size split +# chunks can be in this scenario, and thus the maximum amount +# of memory consumed for in-memory splitting. Default: [10m] +# +# Note that you may specify previously defined dumptypes as a shorthand way of +# defining parameters. + +define dumptype global { + comment "Global definitions" + # This is quite useful for setting global parameters, so you don't have + # to type them everywhere. All dumptype definitions in this sample file + # do include these definitions, either directly or indirectly. + # There's nothing special about the name `global'; if you create any + # dumptype that does not contain the word `global' or the name of any + # other dumptype that contains it, these definitions won't apply. + # Note that these definitions may be overridden in other + # dumptypes, if the redefinitions appear *after* the `global' + # dumptype name. + # You may want to use this for globally enabling or disabling + # indexing, recording, etc. Some examples: + # index yes + # record no + # split_diskbuffer "/raid/amanda" + # fallback_splitsize 64m +} + +define dumptype always-full { + global + comment "Full dump of this filesystem always" + compress none + priority high + dumpcycle 0 +} + +# Dumptypes for gnutar +define dumptype root-tar { + global + program "GNUTAR" + comment "root partitions dumped with tar" + compress none + index +# exclude list "/etc/amanda/exclude.gtar" + priority low +} + +define dumptype user-tar { + root-tar + comment "user partitions dumped with tar" + priority medium +} + +define dumptype user-tar-span { + root-tar + tape_splitsize 3 Gb + comment "tape-spanning user partitions dumped with tar" + priority medium +} + +define dumptype high-tar { + root-tar + comment "partitions dumped with tar" + priority high +} + +define dumptype comp-root-tar { + root-tar + comment "Root partitions with compression" + compress client fast +} + +define dumptype comp-user-tar { + user-tar + compress client fast +} + +define dumptype comp-user-tar-span { + user-tar-span + compress client fast +} + +define dumptype holding-disk { + global + comment "The master-host holding disk itself" + holdingdisk never # do not use the holding disk + priority medium +} + +define dumptype comp-user { + global + comment "Non-root partitions on reasonably fast machines" + compress client fast + priority medium +} + +define dumptype comp-user-span { + global + tape_splitsize 5 Gb + comment "Tape-spanning non-root partitions on reasonably fast machines" + compress client fast + priority medium +} + +define dumptype nocomp-user { + comp-user + comment "Non-root partitions on slow machines" + compress none +} + +define dumptype nocomp-user-span { + comp-user-span + comment "Tape-spanning non-root partitions on slow machines" + compress none +} + +define dumptype comp-root { + global + comment "Root partitions with compression" + compress client fast + priority low +} + +define dumptype nocomp-root { + comp-root + comment "Root partitions without compression" + compress none +} + +define dumptype comp-high { + global + comment "very important partitions on fast machines" + compress client best + priority high +} + +define dumptype nocomp-high { + comp-high + comment "very important partitions on slow machines" + compress none +} + +define dumptype nocomp-test { + global + comment "test dump without compression, no /etc/dumpdates recording" + compress none + record no + priority medium +} + +define dumptype comp-test { + nocomp-test + comment "test dump with compression, no /etc/dumpdates recording" + compress client fast +} + +define dumptype custom-compress { + global + program "GNUTAR" + comment "custom client compression dumped with tar" + compress client custom + client_custom_compress "/usr/bin/bzip2" +} + +define dumptype server-encrypt-fast { + global + program "GNUTAR" + comment "fast client compression and server symmetric encryption" + compress client fast + encrypt server + server_encrypt "/usr/sbin/amcrypt" + server_decrypt_option "-d" +} + +define dumptype client-encrypt-nocomp { + global + program "GNUTAR" + comment "no compression and client symmetric encryption" + compress none + encrypt client + client_encrypt "/usr/sbin/amcrypt" + client_decrypt_option "-d" +} + + +# To use gpg public-key encryption, gpg does compress with zlib by default. +# Thus, no need to specify compress + +#define dumptype gpg-encrypt { +# global +# program "GNUTAR" +# comment "server public-key encryption, dumped with tar" +# compress none +# encrypt server +# server_encrypt "/usr/sbin/amgpgcrypt" +# server_decrypt_option "-d" +#} + + +# network interfaces +# +# These are referred to by the disklist file. They define the attributes +# of the network interface that the remote machine is accessed through. +# Notes: - netusage above defines the attributes that are used when the +# disklist entry doesn't specify otherwise. +# - the values below are only samples. +# - specifying an interface does not force the traffic to pass +# through that interface. Your OS routing tables do that. This +# is just a mechanism to stop Amanda trashing your network. +# Attributes are: +# use - bandwidth above which amanda won't start +# backups using this interface. Note that if +# a single backup will take more than that, +# amanda won't try to make it run slower! + +define interface local { + comment "a local disk" + use 8000 kbps +} + +#define interface le0 { +# comment "10 Mbps ethernet" +# use 400 kbps +#} + +# You may include other amanda configuration files, so you can share +# dumptypes, tapetypes and interface definitions among several +# configurations. + +#includefile "/etc/amanda/amanda.conf.main" diff --git a/server-src/amdump.sh b/server-src/amdump.sh new file mode 100644 index 0000000..70a0a7f --- /dev/null +++ b/server-src/amdump.sh @@ -0,0 +1,225 @@ +#!@SHELL@ +# +# Amanda, The Advanced Maryland Automatic Network Disk Archiver +# Copyright (c) 1991-1998 University of Maryland at College Park +# All Rights Reserved. +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of U.M. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. U.M. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M. +# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# Author: James da Silva, Systems Design and Analysis Group +# Computer Science Department +# University of Maryland at College Park +# + +# +# amdump: Manage running one night's Amanda dump run. +# + +prefix="@prefix@" +exec_prefix="@exec_prefix@" +sbindir="@sbindir@" +amlibexecdir="@amlibexecdir@" +. "${amlibexecdir}/amanda-sh-lib.sh" + +confdir=@CONFIG_DIR@ + +# add sbin and ucb dirs +PATH="$PATH:/usr/sbin:/sbin:/usr/ucb" +export PATH + +USE_VERSION_SUFFIXES="@USE_VERSION_SUFFIXES@" +if test "$USE_VERSION_SUFFIXES" = "yes"; then + SUF="-@VERSION@" +else + SUF= +fi + +if [ $# -lt 1 ] +then +<<<<<<< HEAD:server-src/amdump.sh.in + echo "Usage: amdump config [host [disk...]...]" 1>&2 +======= + echo `_ 'Usage: %s config [host [disk...]...]' "$0"` 1>&2 +>>>>>>> upstream:server-src/amdump.sh + exit 1 +fi + +exit_status=0; + +conf=$1 +if [ ! -d $confdir/$conf ]; then +<<<<<<< HEAD:server-src/amdump.sh.in + echo "amdump$SUF: could not find directory $confdir/$conf" 1>&2 +======= + echo `_ '%s: could not find directory %s' "amdump$SUF" "$confdir/$conf"` 1>&2 +>>>>>>> upstream:server-src/amdump.sh + exit 1 +fi +shift + +cd $confdir/$conf || exit 1 + +logdir=`amgetconf$SUF $conf logdir "$@"` +[ $? -ne 0 ] && exit 1 +errfile=$logdir/amdump +tapecycle=`amgetconf$SUF $conf tapecycle "$@"` +[ $? -ne 0 ] && exit 1 +dumpuser=`amgetconf$SUF $conf dumpuser "$@"` +[ $? -ne 0 ] && exit 1 + +runuser=`{ whoami ; } 2>/dev/null` +if [ $? -ne 0 ]; then + idinfo=`{ id ; } 2>/dev/null` + if [ $? -ne 0 ]; then + runuser=${LOGNAME:-"??unknown??"} + else + runuser=`echo $idinfo | sed -e 's/).*//' -e 's/^.*(//'` + fi +fi + +<<<<<<< HEAD:server-src/amdump.sh.in +#if [ $runuser != $dumpuser ]; then +# echo "amdump: must be run as user $dumpuser, not $runuser" 1>&2 +# exit 1 +#fi + +if test -f hold; then + echo "amdump: waiting for hold file to be removed" 1>&2 +======= +if [ $runuser != $dumpuser ]; then + echo `_ '%s: must be run as user %s, not %s' "$0" "$dumpuser" "$runuser"` 1>&2 + exit 1 +fi + +if test -f hold; then + echo `_ '%s: waiting for hold file to be removed' "$0"` 1>&2 +>>>>>>> upstream:server-src/amdump.sh + while test -f hold; do + sleep 60 + done +fi + +if test -f $errfile || test -f $logdir/log; then +<<<<<<< HEAD:server-src/amdump.sh.in + echo "amdump: amdump or amflush is already running, or you must run amcleanup" 1>&2 +======= + echo `_ '%s: amdump or amflush is already running, or you must run amcleanup' "$0"` 1>&2 +>>>>>>> upstream:server-src/amdump.sh + exit 1 +fi + +umask 077 + +exit_code=0 +# Plan and drive the dumps. +#exec $errfile 2>&1 +touch $errfile +exit_code=$? +[ $exit_code -ne 0 ] && exit_status=$exit_code +exec >$errfile 1>&2 +exit_code=$? +[ $exit_code -ne 0 ] && exit_status=$exit_code +<<<<<<< HEAD:server-src/amdump.sh.in +echo "amdump: start at `date`" +echo "amdump: datestamp `date +%Y%m%d`" +echo "amdump: starttime `date +%Y%m%d%H%M%S`" +$libexecdir/planner$SUF $conf "$@" | $libexecdir/driver$SUF $conf "$@" +exit_code=$? +[ $exit_code -ne 0 ] && exit_status=$exit_code +echo "amdump: end at `date`" +======= + +gdate=`date +'%a %b %e %H:%M:%S %Z %YAAAAA%Y%m%dBBBBB%Y%m%d%H%M%SCCCCC%Y-%m-%d %H:%M:%S %Z'` + +#date=%a %b %e %H:%M:%S %Z %Y +date=`echo $gdate |sed -e "s/AAAAA.*$//"` + +#date_datestamp="%Y%m%d" +date_datestamp=`echo $gdate |sed -e "s/^.*AAAAA//;s/BBBBB.*$//"` + +#date_starttime="%Y%m%d%H%M%S" +date_starttime=`echo $gdate |sed -e "s/^.*BBBBB//;s/CCCCC.*$//"` + +#date_locale_independent=%Y-%m-%d %H:%M:%S %Z +date_locale_independent=`echo $gdate |sed -e "s/^.*CCCCC//"` + +printf '%s: start at %s\n' "amdump" "$date" +printf '%s: datestamp %s\n' "amdump" "$date_datestamp" +printf '%s: starttime %s\n' "amdump" "$date_starttime" +printf '%s: starttime-locale-independent %s\n' "amdump" "$date_locale_independent" + +$amlibexecdir/planner$SUF $conf --starttime $date_starttime "$@" | $amlibexecdir/driver$SUF $conf "$@" +exit_code=$? +[ $exit_code -ne 0 ] && exit_status=$exit_code +printf '%s: end at %s\n' "amdump" "`date`" +>>>>>>> upstream:server-src/amdump.sh + +# Send out a report on the dumps. +$sbindir/amreport$SUF $conf "$@" +exit_code=$? +[ $exit_code -ne 0 ] && exit_status=$exit_code + +# Roll the log file to its datestamped name. +<<<<<<< HEAD:server-src/amdump.sh.in +$libexecdir/amlogroll$SUF $conf "$@" +======= +$amlibexecdir/amlogroll$SUF $conf "$@" +>>>>>>> upstream:server-src/amdump.sh +exit_code=$? +[ $exit_code -ne 0 ] && exit_status=$exit_code + +# Trim the log file to those for dumps that still exist. +<<<<<<< HEAD:server-src/amdump.sh.in +$libexecdir/amtrmlog$SUF $conf "$@" +======= +$amlibexecdir/amtrmlog$SUF $conf "$@" +>>>>>>> upstream:server-src/amdump.sh +exit_code=$? +[ $exit_code -ne 0 ] && exit_status=$exit_code + +# Trim the index file to those for dumps that still exist. +<<<<<<< HEAD:server-src/amdump.sh.in +$libexecdir/amtrmidx$SUF $conf "$@" +======= +$amlibexecdir/amtrmidx$SUF $conf "$@" +>>>>>>> upstream:server-src/amdump.sh +exit_code=$? +[ $exit_code -ne 0 ] && exit_status=$exit_code + +# Keep a debug log through the tapecycle plus a couple of days. +maxdays=`expr $tapecycle + 2` +days=1 +# First, find out the last existing errfile, +# to avoid ``infinite'' loops if tapecycle is infinite +while [ $days -lt $maxdays ] && [ -f $errfile.$days ]; do + days=`expr $days + 1` +done +# Now, renumber the existing log files +while [ $days -ge 2 ]; do + ndays=`expr $days - 1` + mv $errfile.$ndays $errfile.$days + exit_code=$? + echo $exit_code + [ $exit_code -ne 0 ] && exit_status=$exit_code + days=$ndays +done +mv $errfile $errfile.1 +exit_code=$? +[ $exit_code -ne 0 ] && exit_status=$exit_code + +exit $exit_status diff --git a/server-src/amverify.sh b/server-src/amverify.sh new file mode 100644 index 0000000..e34cd4e --- /dev/null +++ b/server-src/amverify.sh @@ -0,0 +1,565 @@ +#! @SHELL@ +# +# $Id: amverify.sh.in,v 1.38 2006/07/25 19:00:56 martinea Exp $ +# +# (C) 1996 by ICEM Systems GmbH +# Author: Axel Zinser (fifi@icem.de) +# +# amverify: check amanda tapes and report errors +# + +echo "amverify is deprecated -- use amcheckdump" >& 2 + +prefix="@prefix@" +exec_prefix="@exec_prefix@" +sbindir="@sbindir@" +amlibexecdir="@amlibexecdir@" +. "${amlibexecdir}/amanda-sh-lib.sh" + +# add sbin and ucb dirs +PATH="$PATH:/usr/sbin:/sbin:/usr/ucb" +export PATH + +USE_VERSION_SUFFIXES="@USE_VERSION_SUFFIXES@" +if [ "$USE_VERSION_SUFFIXES" = "yes" ]; then + SUF="-@VERSION@" +else + SUF= +fi + +# If the shell/system echo support \r and \c, use them to write some +# status messages over the top of each other as things progress, otherwise +# use a normal echo and let them go on new lines. Define $Echoe to be +# an echo that goes to stderr. In the code, $Echoe is used and it may +# be either echoe or echone, the latter being code that knows about echon. + +t=`echo "abc\r\c" | wc -c` +if [ $t -eq 4 ]; then + Echon=echon +else + Echon=echo +fi +Echoe=echoe +elen=0 +echoe() { + echo "$@" >&2 + Echoe=echoe +} +echon() { + newelen=`expr "$1" : '.*'` + blanks= + while [ $newelen -lt $elen ]; do + blanks="$blanks " + elen=`expr $elen - 1` + done + echo "$1""$blanks\r\c" + elen=$newelen + Echoe=echone +} +echone() { + echon + echoe "$@" + Echoe=echoe +} + +report() { + $Echoe "$@" + echo "$@" >> $REPORT +} + +getparm() { + $AMGETCONF $CONFIG $1 2>/dev/null +} + +sendreport() { + if [ -f $REPORT -a X"$REPORTTO" != X"" ]; then + ( + echo `_ 'Tapes: %s' "$TAPELIST"` + if [ -s $DEFECTS ]; then + echo `_ 'Errors found:'` + cat $DEFECTS + else + echo `_ 'No errors found!'` + fi + echo + + [ -s $REPORT ] \ + && cat $REPORT + ) | ( + if test -n "$MAIL"; then + $MAIL -s "$ORG AMANDA VERIFY REPORT FOR$TAPELIST" $REPORTTO + else + cat >&2 + fi + ) + fi +} + +### +# This function is called to process one dump image. Standard input is +# the dump image. We parse the header and decide if it is a GNU tar +# dump or a system dump. Then we do a catalog operation to /dev/null +# and finally a "cat" to /dev/null to soak up whatever data is still in +# the pipeline. +# +# In the case of a system restore catalogue, this does not fully check +# the integrity of the dump image because system restore programs stop +# as soon as they are done with the directories, which are all at the +# beginning. But the trailing cat will at least make sure the whole +# image is readable. +### + +doonefile() { + + ### + # The goal here is to collect the first 32 KBytes and save the + # first line. But the pipe size coming in to us from amrestore + # is highly system dependent and "dd" does not do reblocking. + # So we pick a block size that is likely to always be available in + # the pipe and a count to take it up to 32 KBytes. Worst case, + # this could be changed to "bs=1 count=32k". We also have to + # soak up the rest of the output after the "head" so an EPIPE + # does not go back and terminate the "dd" early. + ### + + HEADER=`$DD bs=512 count=64 2>/dev/null | ( sed 1q ; cat > /dev/null )` + CMD= + result=1 + if [ X"$HEADER" = X"" ]; then + echo `_ '** No header'` > $TEMP/errors + else + set X $HEADER + # XXX meh, while[] is dangerous, what about a bad header? + while [ X"$1" != X"program" ]; do shift; done + if [ X"$1" = X"program" -a X"$2" != X"" ]; then + if [ X"$TAR" != X"" \ + -a \( X"`basename $2`" = X"`basename $TAR`" \ + -o X"`basename $2`" = X"gtar" \ + -o X"`basename $2`" = X"gnutar" \ + -o X"`basename $2`" = X"tar" \) ]; then + CMD=$TAR + ARGS="tf -" + elif [ X"$TAR" != X"" \ + -a X"$SAMBA_CLIENT" != X"" \ + -a X"$2" = X"$SAMBA_CLIENT" ]; then + CMD=$TAR + ARGS="tf -" + elif [ X"$DUMP" != X"" -a X"$2" = X"$DUMP" ]; then + CMD=$RESTORE + if [ $IS_AIX -eq 1 ]; then + ARGS=-tB + else + ARGS="tbf 2 -" + fi + elif [ X"$VDUMP" != X"" -a X"$2" = X"$VDUMP" ]; then + CMD=$VRESTORE + ARGS="tf -" + elif [ X"$VXDUMP" != X"" -a X"$2" = X"$VXDUMP" ]; then + CMD=$VXRESTORE + ARGS="tbf 2 -" + elif [ X"$XFSDUMP" != X"" -a X"$2" = X"$XFSDUMP" ]; then + CMD=$XFSRESTORE + ARGS="-t -v silent -" + else + echo `_ '** Cannot do %s dumps' "$2"` > $TEMP/errors + result=999 # flag as not really an error + fi + else + echo `_ '** Cannot find dump type'` > $TEMP/errors + fi + fi + echo $CMD > $TEMP/onefile.cmd + if [ X"`echo $HEADER | grep '^AMANDA: SPLIT_FILE'`" != X"" ]; then + result=500 + set X $HEADER + shift 7 + echo $1 | cut -f7 -d' ' > $TEMP/onefile.partnum + elif [ X"$CMD" != X"" ]; then + if [ -x $CMD ]; then + $CMD $ARGS > /dev/null 2> $TEMP/errors + result=$? + else + echo `_ '** Cannot execute %s' "$CMD"` > $TEMP/errors + fi + fi + cat >/dev/null # soak up the rest of the image + echo $result +} + +# +# some paths +# +# CONFIG_DIR directory in which the config file resides +# AMRESTORE full path name of amrestore +# AMGETCONF full path name of amgetconf +# AMTAPE full path name of amtape +# TAR ditto for GNU-tar +# SAMBA_CLIENT ditto for smbclient +# DUMP ditto for the system dump program +# RESTORE ditto for the system restore program +# VDUMP ditto for the system dump program +# VRESTORE ditto for the system restore program +# VXDUMP ditto for the system dump program +# VXRESTORE ditto for the system restore program +# XFSDUMP ditto for the system dump program +# XFSRESTORE ditto for the system restore program +# DD ditto for dd +# MT ditto for mt +# MTF flag given to MT to specify tape device: -f or -t +# MAIL mail program +# IS_AIX true if this is an AIX system + +CONFIG_DIR=@CONFIG_DIR@ +amlibexecdir=$amlibexecdir +sbindir=$sbindir +AMRESTORE=$sbindir/amrestore$SUF +AMGETCONF=$sbindir/amgetconf$SUF +AMTAPE=$sbindir/amtape$SUF +TAR=@GNUTAR@ +SAMBA_CLIENT=@SAMBA_CLIENT@ +DUMP=@DUMP@ +RESTORE=@RESTORE@ +VDUMP=@VDUMP@ +VRESTORE=@VRESTORE@ +VXDUMP=@VXDUMP@ +VXRESTORE=@VXRESTORE@ +XFSDUMP=@XFSDUMP@ +XFSRESTORE=@XFSRESTORE@ +MAIL=@MAILER@ +DD=@DD@ + +. ${amlibexecdir}/chg-lib.sh + +# +# config file +# +SLOT=0 +CONFIG=$1 +[ X"$CONFIG" = X"" ] \ + && $Echoe "usage: amverify$SUF [slot [ runtapes ] ]" \ + && exit 1 + +AMCONFIG=$CONFIG_DIR/$CONFIG/amanda.conf +[ ! -f $AMCONFIG ] \ + && $Echoe "Cannot find config file $AMCONFIG" \ + && exit 1 + +TPCHANGER=`getparm tpchanger` +if [ X"$TPCHANGER" = X"" ]; then + $Echoe "No tape changer..." + DEVICE=`getparm tapedev` + [ X"$DEVICE" = X"" ] \ + && $Echoe "No tape device..." \ + && exit 1 + $Echoe "Tape device is $DEVICE..." + SLOTS=1 +else + CHANGER_SLOT=${2:-current} + $Echoe "Tape changer is $TPCHANGER..." + SLOTS=${3:-`getparm runtapes`} + [ X"$SLOTS" = X"" ] && SLOTS=1 + if [ $SLOTS -eq 1 ]; then + p="" + else + p=s + fi + $Echoe "$SLOTS slot${p}..." + MAXRETRIES=2 +fi + +# +# check the accessability +# +[ X"$TAR" != X"" -a ! -x "$TAR" ] \ + && $Echoe "GNU tar not found: $TAR" +[ X"$DUMP" != X"" -a \( X"$RESTORE" = X"" -o ! -x "$RESTORE" \) ] \ + && $Echoe "System restore program not found: $RESTORE" +[ X"$VDUMP" != X"" -a \( X"$VRESTORE" = X"" -o ! -x "$VRESTORE" \) ] \ + && $Echoe "System restore program not found: $VRESTORE" +[ X"$VXDUMP" != X"" -a \( X"$VXRESTORE" = X"" -o ! -x "$VXRESTORE" \) ] \ + && $Echoe "System restore program not found: $VXRESTORE" +[ X"$XFSDUMP" != X"" -a \( X"$XFSRESTORE" = X"" -o ! -x "$XFSRESTORE" \) ] \ + && $Echoe "System restore program not found: $XFSRESTORE" +[ ! -x $AMRESTORE ] \ + && $Echoe "amrestore not found: $AMRESTORE" \ + && exit 1 + +REPORTTO=`getparm mailto` +if [ X"$REPORTTO" = X"" ]; then + $Echoe "No notification by mail!" +else + $Echoe "Verify summary to $REPORTTO" +fi + +ORG=`getparm org` +if [ X"$ORG" = X"" ]; then + $Echoe "No org in amanda.conf -- using $CONFIG" + ORG=$CONFIG +fi + +# +# ok, let's do it +# +# TEMP directory for temporary tar archives and stderr +# DEFECTS defect list +# REPORT report for mail + +if [ ! -d @AMANDA_TMPDIR@ ]; then + $Echoe "amverify: directory @AMANDA_TMPDIR@ does not exist." + exit 1 +fi + +cd @AMANDA_TMPDIR@ || exit 1 + +TEMP=@AMANDA_TMPDIR@/amverify.$$ +trap 'rm -fr $TEMP' EXIT +if ( umask 077 ; mkdir $TEMP ) ; then + : +else + $Echoe "Cannot create $TEMP" + exit 1 +fi +DEFECTS=$TEMP/defects; rm -f $DEFECTS +REPORT=$TEMP/report; rm -f $REPORT +TAPELIST= +EXITSTAT=$TEMP/amrecover.exit; rm -rf $EXITSTAT + +<<<<<<< HEAD:server-src/amverify.sh.in +trap 'report "aborted!"; echo "aborted!" >> $DEFECTS; sendreport; rm -fr $TEMP; exit 1' EXIT +======= +trap 'report "aborted!"; echo `_ 'aborted!'` >> $DEFECTS; sendreport; rm -fr $TEMP; exit 1' 1 2 3 4 5 6 7 8 10 12 13 14 15 +>>>>>>> upstream:server-src/amverify.sh + +$Echoe "Defects file is $DEFECTS" +report "amverify $CONFIG" +report "`date`" +report "" + +# ---------------------------------------------------------------------------- + +SPLIT_DUMPS= # this will keep track of split dumps that we'll tally later +while [ $SLOT -lt $SLOTS ]; do + SLOT=`expr $SLOT + 1` + # + # Tape Changer: dial slot + # + if [ X"$TPCHANGER" != X"" ]; then + report "Loading ${CHANGER_SLOT} slot..." + $AMTAPE $CONFIG slot $CHANGER_SLOT > $TEMP/amtape.out 2>&1 + THIS_SLOT=$CHANGER_SLOT + CHANGER_SLOT=next + RESULT=`grep "changed to slot" $TEMP/amtape.out` + [ X"$RESULT" = X"" ] \ + && report "** Error loading slot $THIS_SLOT" \ + && report "`cat $TEMP/amtape.out`" \ + && cat $TEMP/amtape.out >> $DEFECTS \ + && continue + DEVICE=`$AMTAPE $CONFIG device` + fi + report "Using device $DEVICE" + $Echon "Waiting for device to go ready..." + count=1800 +<<<<<<< HEAD:server-src/amverify.sh.in + until eval $DEVICE_READY > $TEMP/ammt.out 2>&1; do + [ count -lt 0 ] \ + && report "Device not ready" \ + && report "`cat $TEMP/ammt.out`" \ + && report cat $TEMP/ammt.out >> $DEFECTS \ + && break; + sleep 3 + count=`expr $count - 3` + done + $Echon "Rewinding..." + ERRORS=0 + until $MT $MTF $DEVICE rewind > $TEMP/ammt.out 2>&1; do + RESULT=`grep "No medium found" $TEMP/ammt.out` + [ X"$RESULT" != X"" ] \ + && report "** Error rewinding tape" \ + && report "`cat $TEMP/ammt.out`" \ + && cat $TEMP/ammt.out >> $DEFECTS \ + && break + ERRORS=`expr $ERRORS + 1` + [ $ERRORS -gt 100 ] \ + && report "** Error rewinding tape" \ + && report "`cat $TEMP/ammt.out`" \ + && cat $TEMP/ammt.out >> $DEFECTS \ + && break + sleep 3 +======= + while true; do + amdevcheck_output="`amdevcheck $CONFIG $DEVICE`" + amdevcheck_status=$? + if [ $amdevcheck_status -eq 0 ]; then + break; + else + if echo $amdevcheck_output | grep UNLABELED > /dev/null; then + if [ count -lt 0 ]; then + report "Device not ready" + break; + fi + sleep 3 + count=`expr $count - 3` + else + report "Volume in $DEVICE unlabeled." + break; + fi + fi +>>>>>>> upstream:server-src/amverify.sh + done + $Echon "Processing label..." + amtape_output="`amtape $CONFIG current 2>&1`"; + if echo "$amtape_output" | \ + egrep "^slot +[0-9]+: time [^ ]+ +label [^ ]+" > /dev/null; then + : # everything is fine + else + report "Error reading tape label using amtape." + continue + fi + + set X $amtape_output + until [ "$1" = "time" ]; do + shift + done + + VOLUME=$4 + DWRITTEN=$2 + report "Volume $VOLUME, Date $DWRITTEN" + [ X"$DWRITTEN" = X"0" -o X"$DWRITTEN" = X"X" ] \ + && report "Fresh tape. Skipping..." \ + && continue + TAPELIST="$TAPELIST $VOLUME" + + FILENO=0 + ERG=0 + ERRORS=0 + while [ $ERG = 0 ]; do +<<<<<<< HEAD:server-src/amverify.sh.in + if [ $Echon = echon ]; then + $Echon "Waiting for device to go ready..." + fi + count=1800 + until eval $DEVICE_READY > $TEMP/ammt.out 2>&1; do + [ count -lt 0 ] \ + && report "Device not ready" \ + && report "`cat $TEMP/ammt.out`" \ + && report cat $TEMP/ammt.out >> $DEFECTS \ + && break; + sleep 3 + count=`expr $count - 3` + done + if [ $Echon = echon ]; then + $Echon "Reading..." + fi + RESULT=`$AMRESTORE -h -p $DEVICE 2> $TEMP/amrestore.out \ + | doonefile 2> $TEMP/onefile.errors` + FILE=`grep restoring $TEMP/amrestore.out \ + | sed 's/^.*restoring //'` + EOF=`grep "reached end of tape" $TEMP/amrestore.out` + EOI=`grep "reached end of information" $TEMP/amrestore.out` + # amrestore: 0: restoring sundae._mnt_sol1_usr.19961127.1 +======= + FILENO=`expr $FILENO + 1` +# { cat < bs=32k skip=1 | /bin/tar -xpGf - ... +#EOF + RESULT=`$AMRESTORE -h -p -f $FILENO $DEVICE \ + 2> $TEMP/amrestore.out \ + | doonefile 2> $TEMP/onefile.errors` + FILE=`grep restoring $TEMP/amrestore.out \ + | sed 's/^.*restoring //'` +>>>>>>> upstream:server-src/amverify.sh + if [ X"$FILE" != X"" -a X"$RESULT" = X"0" ]; then + report "Checked $FILE" + elif [ X"$FILE" != X"" -a X"$RESULT" = X"500" ]; then + report "Skipped `cat $TEMP/onefile.cmd` check on partial dump $FILE" + dump="`echo $FILE | cut -d'.' -f'1,2,3,4'`" + cat $TEMP/onefile.partnum >> $TEMP/$dump.parts + if [ X"`echo $SPLIT_DUMPS | grep $dump`" = X"" ]; then + SPLIT_DUMPS="$dump $SPLIT_DUMPS" + fi + elif [ X"$FILE" != X"" -a X"$RESULT" = X"999" ]; then + report "Skipped $FILE (`cat $TEMP/errors`)" + elif [ -z "$FILE" ]; then + # Unless we went over, there is no extra output. + report "End-of-Tape detected." + break + elif [ -n "$EOI" ]; then + report "End-of-Information detected." + break + else + report "** Error detected ($FILE)" + echo "$VOLUME ($FILE):" >>$DEFECTS + [ -s $TEMP/amrestore.out ] \ + && report "`cat $TEMP/amrestore.out`" \ + && cat $TEMP/amrestore.out >>$DEFECTS + [ -s $TEMP/errors ] \ + && report "`cat $TEMP/errors`" \ + && cat $TEMP/errors >>$DEFECTS + [ -s $TEMP/onefile.errors ] \ + && report "`cat $TEMP/onefile.errors`" \ + && cat $TEMP/onefile.errors >>$DEFECTS + ERRORS=`expr $ERRORS + 1` + [ $ERRORS -gt 5 ] \ + && report "Too many errors." \ + && break + fi + done + rm -f $TEMP/header \ + $TEMP/amtape.out \ + $TEMP/amrestore.out \ + $TEMP/errors \ + $TEMP/onefile.cmd \ + $TEMP/onefile.partnum \ + $TEMP/onefile.errors +done + +[ -s $DEFECTS ] \ + && $Echoe "Errors found: " \ + && cat $DEFECTS + +# Work out whether any split dumps we saw had all their parts +for dump in $SPLIT_DUMPS;do + report "" + numparts=0 + max=0 + max_known=0 + missing=0 + # figure out + for part in `cat $TEMP/$dump.parts`;do + cur="`echo $part | cut -d/ -f1`" + max="`echo $part | cut -d/ -f2`" + if [ $max != "UNKNOWN" ]; then + numparts=$max + max_known=1 + break; + fi + if [ $cur -gt $numparts ]; then + numparts=$cur + fi + done + report "Split dump $dump should have $numparts total pieces" + if [ $max_known != 1 ]; then + report "NOTE: Header field for total pieces was UNKNOWN, $numparts is best guess" + fi + part=1 + while [ $part -lt $numparts ];do + part=`expr $part + 1` + if [ X"`grep \"^$part/\" $TEMP/$dump.parts`" = X"" ];then + report "Spanning chunk part $part is missing!" + missing=`expr $missing + 1` + fi + done + if [ $missing = 0 ];then + report "All parts found" + fi + rm -f $TEMP/$dump.parts +done + +sendreport + +rm -fr $TEMP +trap - EXIT + +exit 0 -- 2.30.2