Cover V03, I01
Article
Listing 1
Listing 2

jan94.tar


Listing 1: Dupback script

:
#   dupback
#
#   Create online copies of files for quick problem
#   recovery.
#
#   Copyright 1993, Lawrence S Reznick

BACKDIR=/usr/local/backup

if [ $# = 0 ]
then
echo "Usage:\t`basename $0` filenames"
echo "\nAges named files into $BACKDIR."
exit 1
fi

test -d $BACKDIR || mkdir -p $BACKDIR

FILES=$*            # Get cmd line before set kills it

for f in $FILES
do
# Use inode option to prevent the file's
# permissions from looking like the set cmd's
# option list!

set `ls -li $f` # Get owner & group settings

for n in 2 1
do
test -f $BACKDIR/$f.$n && \
mv -f $BACKDIR/$f.$n $BACKDIR/$f.`expr $n + 1`
done

cp $f $BACKDIR/$f.1

chmod `/usr/local/bin/getperm $BACKDIR/$f.1`
chgrp $5 $BACKDIR/$f.1
chown $4 $BACKDIR/$f.1
done