#! /bin/sh
## Example minimalist automatic-backup handler, using L5 to scan for new
## files.  Fire off from cron or something.
## L5 had better be in the path someplace.

# settable stuff:
# control directory where timestamps and logs live
BDIR=/etc/backup
# list of filesystems to back up
SRCS='/ /usr /u1 /u2'
# treehead of where to put it all
DEST=/backup
# logfile
LOGF=backup.log

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/bsd:/usr/local/bin
export PATH

cd $BDIR
if test ! -f TS ; then
  echo "Whoops!  No timestamp.  Punting..."
  exit 1
fi

echo '' >> $LOGF
date "+ *** Backup run of %a  %y%m%d.%H%M%S ***" >> $LOGF
touch TS.new
l5 -q -t TS $SRCS | cpio -pvadm $DEST >> $LOGF 2>&1
sync
mv TS.new TS

## and that's all there is to it!
exit 0
