[net.sources] Simple Shell Script For Incremental Back-ups

perry@heurikon.UUCP (Perry Kivolowitz) (10/31/84)

The following is a simple shell script and man page for a back-up utility
we find useful. No mail, please, about existence of other thingies to  do
the same thing. Note: /dev/tp1 is  the  name of our streaming tape drive.
This script should work on any system that has cpio (and csh).

						      Perry S. Kivolowitz
						      Heurikon Corp

---------------------------------------------------------------------
.TH BACKUP 8
.SH NAME
backup \- make incremental back-ups to streaming tape
.SH SYNOPSIS
.B backup
.SH DESCRIPTION
.I Backup\^
will search the known file system for files which have been modified in the
last calendar day (except if run on fridays in which case file systems will
be searched for files modified in the preceeding 7 calendar days).
The resulting list of pathnames will be compared against the file
.I "/etc/dont_backup"\^
which contains a non-empty list of pathname patterns. If a match is found
the file being considered for back-up will not be backed-up. This allows
the system administrator to remove certain files or subtrees from
consideration for back-up (a good candidate for this is /usr/spool).
.SH FILES
.ta \w'/etc/dont_backup\ \ \ 'u
/etc/dont_backup	list of patterns for back-up exclusion
.DT
--------------------------------------------------------------------
#
cd /
set days=1
set today=`date`
echo -n "Date:" $today[1-3] "- "
set today=$today[0]
if ($today == "Fri") set days=7
echo -n "Backing Files Modified in the Last "
if ($days == "1") then
	echo Day
else
	echo $days Days
endif
echo -n "Insert Tape Cartridge and Hit CR "
set dummy=`line`
erase
find . -mtime $days -print | \
	egrep -v -f /etc/dont_backup | \
	cpio -ocv > /dev/tp1
--------------------------------------------------------------------