#!/bin/sh
#
# $Id: dailybackup,v 1.2 2000/12/29 21:33:09 donncha Exp $
#
# dailybackup by Donncha O Caoimh.
# donncha@linux.ie
# http://cork.linux.ie/

source /etc/tob.rc

today=`date '+%B.%d.%Y'`
lastweek=`date --date '1 week ago' '+%B.%d.%Y'`
dayofweek=`date '+%w'`

if [ "$1" = "--full" ] ; then
  # Make a full backup.
  BACKUPDAY=$dayofweek
fi

if [ $dayofweek -eq $BACKUPDAY ]; then
 param="-full"
 t="full";
else
 param="-inc"
 t="inc";
fi
for i in home system
 do
 /sbin/tob $param $i 
 mv -f $BACKUPDEV $BACKUPDIR/$today.$t.$i.tar.gz
 rm -f $BACKUPDIR/$lastweek.$t.$i.tar.gz
done

