head	1.8;
access;
symbols;
locks
	romig:1.8; strict;
comment	@# @;


1.8
date	94.04.10.23.48.20;	author romig;	state Exp;
branches;
next	1.7;

1.7
date	93.06.12.01.01.17;	author romig;	state Exp;
branches;
next	1.6;

1.6
date	93.01.07.13.15.34;	author romig;	state Exp;
branches;
next	1.5;

1.5
date	92.05.12.16.12.15;	author romig;	state Exp;
branches;
next	1.4;

1.4
date	92.05.12.15.17.21;	author romig;	state Exp;
branches;
next	1.3;

1.3
date	92.04.17.11.01.04;	author romig;	state Exp;
branches;
next	1.2;

1.2
date	92.03.18.16.52.14;	author romig;	state Exp;
branches;
next	1.1;

1.1
date	91.11.16.11.44.20;	author romig;	state Exp;
branches;
next	;


desc
@Change log
@


1.8
log
@changes for 2.6
@
text
@2.6
	check-backups.perl, list-backups.perl, backup-report.perl, 
	getdata.perl:
	    Changed &sigh("clean-db" to appropriate program name.

	list-backups.perl:
	    Don't abort if you can't open a backup database file name, 
	    just print a message and go on.

	backup.tex:
	    Changed refs to /etc/backups to $db_dir/backups.

	    Included advice about creating /backup as a CDF in HP
	    clusters. 

	backup-dump:
	    oops, fixed reference to clean_up_dumpdates to clean_up_dd 

	    lock /tmp/dumpdates.host instead of /tmp/dumpdates so that
	    backups on HP clusters that share /tmp will work.  Sigh. 

	reuse:
	    don't log reuse of a tape until after we've confirmed that
	    its in the database and that they really want to use it. 

	all-backups.8:
	    Added missing \n to end of the file

	    Added some verbage about the deadman switches.

	    Described how to use -C and tell it not to check so that
	    it won't ask.

	all-backups.8, do-backups.8, getback.8, check-backups.8,
	backups.5: 
	    Corrected description of the backups to note that it might
	    be in the database directory rather than /etc.

	local.defs, backup-gtar.perl:
	    Changed GNU tar long arg prefix to --, sigh.  Hard coded
	    rather than using John's patches since everyone ought to
	    use 11.2 and one hopes that the FSF folks won't change it 
	    again.

	local.defs:
	    Autoconfig $svr4 and add /sbin to the search_path.

	    Changed $dumpdates_lock to dumpdates.hostname so that
	    backups on HP clusters work.

	do-backups, lib-misc:
	    Oops, wasn't handling -i tag,tag or -x tag,tag correctly -
	    thanks, John!  Added find_element_in_list to lib-misc.perl.

2.6 pre
	Documentation
	    Changed complimentary to complementary, miscellania to
	    miscellanea. 

	all-backups, getback
	    Changed -N to -e to match add-tape (no eject switch).

2.6beta patch2
	Misc
	    &parse_date_into_timestamp now lowercases the date string
	    first, so you can use upper or lower case.  This affects
	    backup-report, getback, getdata and list-backups.

	    Try to create the $error_dir if it doesn't exist.

	    Use $gtar_exclude_hook to unset $gtar_exclude if the file 
	    doesn't exist.

	    Updated backups.5 man page to reflect host:dir changes.

	    Bah, didn't qualify $deadman_dir in global.defs with package
	    name, so it was ignored.

	    &lock complains after 45 seconds when a lock can't be gotten, 
	    just so you know while U wait

	    fixed various places where we die'd instead of running
	    unlock_all and then die. 

	    read_backups_entry - didn't clear $script, so if there was a 
	    script= entry on one line, subsequent lines inherited it.

	    The buid_list field in the run_host database is now optional.

	    Changed most error messages to start with "warning" or "error".

	    Added support for riscos.  Use dump/rdump, restore/rrestore
	    as needed.  Grok /dev/root and /dev/usr.  Use telinit
	    instead of fastboor/reboot.  Added ffs as a new file system
	    type, added /bsd43/bin to @@search_path.

	    documented # as a comment in backups.5.

	    note in the man page for all-backups that it won't eject the
	    tape if it looks like its the wrong one since you might have
	    given the wrong drive and we don't want to mess with someone
	    else's tape. 

	    /etc/backups now accepts host:filesystem, so that you can
	    merge them all together and stick it in your $db_dir. 

        deadman switches
	    Added calls to &deadman to invoke deadman watchers for
	    all-backups, do-backups, backup-dump and backup-gtar.  You
	    can now specify timeouts in /etc/backups to cause it to nuke
	    backups that are taking too long.

	backup-report
	    changed occurances of list-backups to backup-report
	all-backups
	    Don't rewrite tape label if we're running with the -M flag.

	    Changed the stuff that runs under at to put the backup
	    output in $output_dir (defined in global.defs), and create a
	    mail message that contains the command line, error messages
	    and then the output.

	    Added -N switch which prevents all-backups from ejecting the
	    tape.

	    Record run_id in the tape DB when tapes are promised.

	    Promise tapes when -t is used.  Added appropriate locks,
	    closes.  Oops.

	    Added the tape ID to the subject: in the mail message.

	    Added -M option which prevents it from verifying the tape
	    before scheduling the job with 'at'.  This can be used to
	    run all-backups from cron and mail the output to people who
	    will find the right tape and mount it in the drive in
	    time for the backup to start.  The tape will still be
	    checked when the real run starts.

	clean-db
	    fixed bogus labels in tape and run loops.

	    don't try to delete lost+found.

	getback
	    Added -N switch which prevents getback from ejecting the
	    tape. 

	    If the wrong tape seemed to be loaded, DON'T offload the
	    tape.  The user might have named the wrong drive, and we
	    don't want to screw around with the tape any more than we
	    have. 

	    When it asks "Change to directory..." you can now name a
	    path for it to cd to, in addition to saying yes or no.

	offsite
	    fixed a debugging message to give correct value for
	    offsite_wait.

	run-clean-db
	    Added variable ($send_empty_mail) to cause it to send/not
	    send empty mail messages. 

2.6beta patch1
	Misc changes:
	    Added interrupt handlers for SIGQUIT and SIGTERM.

	    do-backups now complains if no backups needed to be done. 

	    get_tape_name now handles default tapes correctly.
 
	all-backups:
	    Fixed stoopid bug in parallel processing code - incorrectly 
	    checked status of read_db in update_budb_for_host, caused 
	    all-backups to abort.

	    Removed unnecessary rewind before tape_put_label.

	    Check status of prints and close of at jobs more thoroughly. 

	clean-db:
	    Removed code that complains when it finds a run-host entry
	    with no value, since they are created that way in do-backups
	    and are left that way if there were no file systems to
	    backup or the host crashed before it could backup one of its
	    file systems or...

	    Warns you if online archives appear to be gone, or asks
	    whether to mark them as deleted if you are using -s.

	backup-dump:
	    interrupt handler cleans up the dumpdates links also.

	    if $only_one_dumpdates is set (defined in local.defs) and
	    there's only one chain then the system won't do any fancy
	    rearrangements with /etc/dumpdates.  This makes it easier
	    to run the backup system as a non-root user with dump,
	    since you can "chgrp backup" the disk devices and
	    /etc/dumpdates.

	getback: 
	    moved get_archive_host_and_file to lib-misc.

	    added a message warning that the tape is being rewound, 
	    may take a while. 

	    pick mode displayed tapes as exb-123,2 instead of .2

	lib-misc:
	    print_run_entry doesn't sort the hosts now (so that you see
	    the results in the order in which they were done (usually)).
	    This affects show run, show scheduled and anything that
	    calls confirm_tape_usage.

	lib-tape:
	    added error checking to the print in tape_put_label.

2.6 beta
	Misc. changes:
	    Moved $at_lock to local.defs so that the host name would be
	    set correctly. 

	    Combine "print stderr; exit(1)" into "die".  Convert
	    "unlock_all; die" into "&sigh".

	    &read_fstab_entry now ignores comments.

	    Created backup-report man page.

	    created $ultrix_dump in addition to $ultrix so that Ultrix
	    users with the gatekeeper dump don't get messed up.

	    rewrote backup-init and -cleanup and renamed them to be
	    single-begin and single-end.

	add-tape: 
	    don't update tape_db if it couldn't update the tape label.

	add-tape, getback, all-backups: 
	    don't call splittapedev since get_tape_name now does that. 

	all-backups: 
	    relabel the tape before rescheduling things with "at" so
	    that we'll find write protected tapes sooner rather than
	    later.  This means that they'll be relabeled twice, but
	    that's ok. 
 
	    fix backup db name to use $host rather than $hostname in
	    &update_budb_for_host().

	    &choose_tape now checks write_formats of the drive against
	    the tape as well as the type.

	    Added lock around use of the 'at' program since Sun's at
	    sometimes loses jobs if you queue a bunch at the same
	    time.  Then fixed it so the lock is specific to a host.

	    Do the host check for single user mode in &init, so we can
	    tell the user about problems before checking the tapes.

	    Now creates db entry before rescheduling the job with 'at'
	    so that there's a record of it from the start (so show
	    scheduled will work).  Added 'scheduled_for' field to the
	    run database entries.

	backuplib: 
	    use splittapedev in get_tape_name, check device name to see
	    if it looks ok (starts with "/dev"), retry if not. 

	    added missing \n in message in get_level

	    changed &make_rsh_cmd() to not use $user if $> isn't 0
	    (since it isn't needed then).

	    changed &make_rsh_cmd() to allow for "rsh host -l" on
	    Ultrix...sigh. 

	    changed confirm_tape_usage to eval the "print_run_entry" so
	    that it won't die if the database doesn't exist.

	    get_recent_backups now returns empty list instead of exiting
	    if the host doesn't have a backup database.

	    &confirm_tape_usage now gives the tape ID when it asks for
	    confirmation.

	    &read_config deals with continuation lines in config file.

	backup-dump:
	    Changed backup-dump to not divide status by 256, since some
	    failures return 0, but with errno set.  backup-dump now
	    returns 0 on success, 1 on failure, so that do-backups will
	    know unambiguously whether the backup worked or not.

	    corrected error message if can't update backup db

	    use $fstab_file_name from local.defs.

	backup-gtar: 
	    corrected error message if can't update backup db

	    corrected backup database name in &find_incr_file_name(). 

	    create $tar_db_dir if it doesn't exist.

	backup-report:
	    removed def'n of &sigh.

	check-backups:
	    use $fstab_file_name from local.defs

	clean-db:
	    fixed stupid bug that nuked databases with 1 entry.

	    removed def'n of &sigh.

	    removed incorrect *unlock_all before warning in &make_seq_file. 

	    now it doesn't remove run database entries until the run
	    would normally expire, so that if you run clean-db while a
	    backup is running, it won't remove entries that haven't been
	    filled in yet.

	    made slight change to the way that tapes are freed - now
	    freed when they are used but have no backups on them, or are
	    promised and timed out.

	do-backups:
	    Default tag for each file system is now host:filesystem, so
	    that you can run "all-backups -i pun:/export/0,fish:/" to do
	    backups on just the named file systems.

	getback:
	    Prints error message if it can't find a best backup sequence
	    instead of printing an empty list.

	getdata:
	    minor typo: run.data --> run.raw in an error message.

	lib-lock.perl:
	    added &sigh, which does unlock_all and dies.

	lib-log.perl:
	    don't die if the log file can't be opened, just warn and
	    return.

	lib-misc.per:
	    don't die in &print_run_entry if we can't open the host 
	    run or backup databases - just bitch and move on.

	    &print_run_entry displays info about scheduled runs now, and
	    doesn't print the done date if it isn't defined.

	    minor formatting changes in print_run_entry - indent all but
	    first line of an entry.

	lib-tape.perl: 
	    changed patterns in tape_position to recognize /file
	    n.*=\s*(\d*)/ rather than /file no=.../ 

	    tape_rewind now uses "pmt rewind" instead of "pmt rew" since 
	    "rew" is ambiguous. 

	list-backups:
	    Fixed a nasty bug in list-backups where it would die if an eval  
	    failed. 

	local.defs:
	    added $fstab_file_name, which should be set to the path 
	    name of the fstab file on this host.

	Makefile: 
	    renamed move-tape to move-tape.perl in SCRIPTS.

	move-tape:
	    use &sigh in place of "unlock_all; die".

	pmt: 
	    make it executable 

	    allow "rew*" rather than just "rew"

	    Converted pmt to perl script so that it could be driven by the 
	    local.defs config info.  Now supports tapecntl, BSD mt and HP
	    mt. 

	reuse:
	    allow tape ids on the command line in addition to -t. 

	    check for tapes that are already free and tell you about
	    them instead of just reusing them silently.

	    don't die if an unknown tape is named, just skip to the
	    next. 

	    don't die if we can't update the tape DB for some tape, just
	    warn and go on to next.

	show:
	    added show scheduled

	run-clean-db:
	    make clean_db_log_dir if it doesn't exist, then chdir (not
	    visa versa).

2.6 alpha 1	August 21, 1992
	Added open_db, read_db, write_db, keys_db, delete_db and
	close_db to lib-db.perl, and rewrote everything else to use
	these rather than references the databases directly.  This way
	someone could replace lib-db with a version that uses a
	relational database system, or one that communicates across
	the net through some sort of server.  Or you could add logging
	routines to log the open/write/delete/close transactions to
	help you debug the db library, or...

	Rather than using "dd" to read the tape label (which causes
	problems on some systems, like Ultrix), use "cat | dd".

	Fixed backup-gtar where it wasn't setting the volhdr field in
	the backup database.

	Added the pmt script that Sxren wrote, which makes mag tape
	manipulations more generic and eliminates need for one host to
	know how to control tapes on another (eg, whether to use mt or
	tapectl).

	Added support for the setuid() call in wrapper.

	Fixed "make clean" to remove maketime*.

	Added /usr/ucblib to the search path in local.defs.

	Changed local.defs to use remsh instead of rsh if it exists.

	Added support for remote users -f user@@host:dev.

	Added restore-gtar, supplied by Sxren.

	Fixed a few places that called dbmopen with mode 640 instead
	of $db_mode (660).

	Added support for scripts to run before/after a backup is done
	(script stop, script start, see /etc/backups)

	all-backups now confirms if you give it a tape with -t that
	isn't free (similar to reuse).

	Added support for Ultrix's fstab which uses : rather than ' '
	and which has the fields in a different order.

	run-clean-db now creates clean_db_log_dir if it doesn't exist
	already.

	Added support for Ultrix's dump which returns status 1 on
	success.  Sigh.

	Added missing chdir(/tmp) to all-backups before running 'at'
	to schedule tape checker, so that 'at' doesn't end up in an
	automounted directory.

	Added better support for default drives - you can have
	different defaults for different tape types/formats.

	Added &gtar_exclude_hook(), which you can use to change
	$gtar_exclude just before gtar is run (like if you want to use
	exclude.host.chain or something crazy like that).

	Changed definition of $HOURS to be based on $MINUTES rather
	than 60 in global.defs.

	Fixed &ok_to_do_this_backup to include $level argument, which
	was causing do-backups to pass '-l' to backup-*.

	Changed the sequence files to be $dbname.$sequence_ext so that
	clean-db can match them to their associated databases
	automatically.
 
	Made clean-db delete empty backup_host and run_host database
	files.

	Made clean-db delete useless sequence files also.

	Changed database names in global.defs to nuke .db.

	getback: added message to tell you when its starting the
	restore so that you know its done positioning the tape.

	Added offsite and checkinout to the Makefile.

	Fixed all-backups to remove afile and d-flags from backup_host
	database if the backup is done in parallel mode and the disk
	copy is being deleted.

	Fixed various places that didn't check the keywords of new db
	entries against the ok_keys list, and added "location" and
	"home" to the ok_keys list for "tape_db".

	Changed backup-dump to use link instead of symlink to make
	dumpdates copies.  Added option to copy instead of link (for
	Ultrix, sigh).

	Added $gtar_vol_prog to local.defs, which you can use to tell
	GNU tar to run some program when it needs a new tape.

	Fixed $gtar_exclude in local.defs to use correct syntax for
	GNU tar	1.10.

	Added $gtar_extra_args to local.defs.  If you want to add
	extra things to the GNU tar command line when you make
	backups, this is the way.

	Changed local.defs to use $ultrix in Ultrix special cases so
	that you don't have to diddle with too many changes.

	Added $dump_extra_keys and $dump_extra_args to local.defs.

	Added $dump_density and $dump_length to local.defs.

	Fixed a bug in getback -f where host:foo didn't work right.

	Added backup-report to the set of programs.

	Fixed bug in read_backups_entry that was clobbering $level
	(and $chain) if a chain= entry was found in the /etc/backups
	file.

	Added -p prefix to add-tape.

	Made the location stuff more generic so that tapes can have
	locations and homes that are distinct from the offsite
	locations. 

	Fixed bug in all-backups -p where the first backup didn't get a
	file number. 

2.5 patch 2	May 12, 1992
	fix for a bug in do-backups - it tried to update the tape
	database with the current file number even if a tape wasn't
	being used. 

2.5 patch 1	May, 1992
	replacements for add-tape.perl, all-backups.perl, 
	backuplib.perl, do-backups.perl, getback.perl,
	tape-check.perl, backup.config.5 and backup.tex:
	added support for tape hosts that don't have a 'good' 
	mt status command. 

	backup-gtar.perl: fixed bug in storing volhdr.

2.5	March, 1992

	Added graph stuff for dump users.

	Added support for offsite tape storage, plus checkinout and
	offsite programs.  

	Tape names now include the type, so instead of tape 123 we
	have exb-123.  This can be confusing.  

	There's no count-free command - use "show tape-summary"
	instead.  It does the same thing.

	The locking system is different, and includes automatic
	cleanup of locks when you ^C out of one of the programs and
	locks now automatically timeout after 10 hours or so.

	You should be able to type ? at any prompt and get a brief
	help message.

	I've added an event log ($db_dir/log) that lists important
	events like when tapes are reused, backup runs are scheduled
	and so on.

	The entries in the backup database will be retained as long as
	specified by the 'keep' time for their level.  If the tape
	that they are on is reused, their status is changed from
	"done" to "reused" and the tape list is deleted, so this won't
	cause confusion for restores.  I did this to facilitate
	debugging strange problems.

	This version fully supports tape types.  It will correctly ask
	for the right type of tape given the drive (or it will ask
	that you mount the tape in the right kind of drive) and so on.

	You can do backups to disk (-m disk) or to tape (default) or
	to both (-m both).  

	You can do backups in parallel (-p) or sequential (default).
	This works whether you are doing the backups to disk or tape
	or both.

	I made use of the .chain files optional, and turned it off in
	our installation.  They were a royal pain, and I don't think
	they were helping us at all.  This is the stuff that would
	complain about "looks like a full restore was done..."...it
	was almost always wrong.

	I changed the format of the /etc/backups file and the
	backup.config file.

	Various (and many) bug fixes.

	Added misc. startup scripts (cis subdirectory).

	Added bunch of test routines.

	Nuked the -n option everywhere.  It was a crock.

	Split backup.defs into global.defs, local.defs.  Made code more 
	portable. 

	Made level definitions apply to 1 chain only, allows more
	flexible configurations.

        Nuked the "current" field in the backup entries - it was 
	always "yes" and so usually wrong.

	all-backups:
	    Added -i, -x, nuked old -m.
	    Miscellaneous fixes for parallel backups, added -m disk|tape|both.
	    Added schedulable tape-checking (-C option).
	    Added run ID to subject line in mail messages.
	    Choose free tape with least number of uses.

	/etc/backups:
	    Changed format, added optional tag, chain and online
	    fields. 

	backup.config:
	    Changed level entry, nuked expire-*, added tape-type,
	    changed tape, level definitions apply to only 1 chain now. 

	add-tape:
	    Check to see if ID is database, tape has label.  -U skips
	      the label check.
	    Added ability to add range of tapes.
	    Re-added the -e switch, which prevents it from ejecting
	      the tape when done.

	check-backups:
	    Reads through fstab and bitches about file systems that
	    aren't listed in /etc/backups.  

	clean-db:
	    Don't nuke promised tapes for some period of time 
	    (promised_timeout in global.defs).

	    Added all sorts of warning and info messages, so that you
	    can shove the verbose output of clean-db to a log file
	    somewhere and grep out the interesting parts for regular
	    monitoring.

	    Added extra checks to find inconsistencies between what
	    run a backup thinks it is in and what backups a run thinks
	    it has, plus checks to find bad or missing sequence files
	    and recreate them.  Also looks for per-host runs that
	    don't have matching entries in the main run DB.

	    Made messages more informative, so that you should be able
	    to determine specifically why a given tape was freed by
	    tracing its run and backups through the output and seeing
	    what actions it took.

	    Fixed a rather massive bug in the way that the sanitize
	    option worked - it was modifying the assoc array while
	    iterating through it, so some entries get skipped, which
	    makes them look like they are gone, so some runs might get
	    nuked and some tapes accidently freed.  Yowza.

	db-edit:
	    Created database editor, nuked hack.

	list-backups:
	    Fixed processing of hosts named on the command line (only
	    took 1 before).  

	    Added ability to restrict output to specific file systems.

	    Added -T switch to allow you to show only backups done
	    before a given date.

	    Added -a to display all backups, including failures.

	reuse:
	    Check to see if tape has a run on it.  Ask for
	    confirmation before freeing...

	run-clean-db:
	    Created short script for running clean-db and logging
	    results, and sending only "interesting" messages through
	    mail. 

	show:
	    Added -r (reverse sort order).
	    Added tape-summary, nuked report/count-free.

	backup-dump, backup-gtar:
	    Moved a bunch of common stuff to do-backups, making them
	    simpler.  Changed command line argument scheme.

2.4	Fall 1991
	Added config name support.

	Added -m marker (now -i, -x tag).

	Changed locking system, added automatic lock timeouts.  Add
	    signal handlers for INTR and HUP, do lock cleanup at
	    all exits.    

2.2	August 26, 1991

	list-run-db: 
	    now detects runs that don't exist in the database

	changed suggested backup-during-boot code for /etc/rc: see
	backup manual for details. 

	restore: 
	    renamed to getback

	getback: 
	    'date' setting now works

	    added pick mode

	    nuked -I, -F, added -m flag in place

	backup-dump: 
	    fixed problem with not unlocking dumpdates before aborting

	all-backups: 
	    if there's a problem when we're in auto-pilot
	    mode, abort everything.

	    also promise tapes that are named with -t

	INSTALL, HOWTO: 
	    merged into backup.tex in Docs directory.

	miscellaneous other fixes

	updated Notes
@


1.7
log
@various changes for 2.6pre
@
text
@d1 55
a55 1
2.6 
@


1.6
log
@final version for 2.6beta
@
text
@d1 164
@


1.5
log
@updates for patch2
@
text
@d1 318
@


1.4
log
@updates for patch 1
@
text
@d1 5
@


1.3
log
@Misc updates for 2.5 release.

@
text
@d1 9
@


1.2
log
@Misc updates for 2.5
@
text
@d3 1
a3 1
	Various (and many) bug fixes.
d5 2
a6 1
	Added misc. startup scripts (cis subdirectory).
d8 2
a9 1
	Added bunch of test routines.
d11 2
a12 1
	Added ? help to &askdef prompts.
d14 3
a16 1
	Added event logs.
d18 2
a19 1
	Added tape-type support, changed format of tape IDs.
d21 3
a23 1
	Support for both on-disk and on-tape backups.
d25 6
a30 1
	Nuked -n option everywhere.  It was a crock.
d32 28
d63 2
a64 2
	Made level definitions apply to 1 chain only, more flexible
	config. 
d66 3
d71 2
a72 2
	    Misc. fixes for parallel backups, added -m disk|tape|both
	    Added schedulable tape-checking.
d74 1
d82 1
a82 1
	    changed tape.
d88 3
a90 1
	
d92 2
a93 2
	    reads through fstab and bitches about file systems that
	    aren't listed in /etc/backups.
d96 2
a97 1
	    Don't nuke promised tapes for 24 hours.
d99 36
d139 5
d146 1
a146 1
	    Added tape-summary, nuked report.
d191 1
a191 1
	misc other fixes
@


1.1
log
@Initial revision
@
text
@d1 71
d74 3
a76 1
	list-run-db: now detects runs that don't exist in the database
d78 17
a94 7
	    backup manual for details. 
	restore: renamed to getback
	getback: 'date' setting now works
	getback: added pick mode
	getback: nuked -I, -F, added -m flag in place
	backup-dump: fixed problem with not unlocking dumpdates before aborting
	all-backups: if there's a problem when we're in auto-pilot
d96 6
a101 2
	all-backups: also promise tapes that are named with -t
	INSTALL, HOWTO: merged into backup.tex in Docs directory.
d103 1
@
