#!/bin/csh -f
# by Cygnus
# cygnus@misty.com

setenv BFILE backup.tar
setenv BACKUPDRIVE backupd

echo /--------------------------------------/
echo / Ncohafmuta 1.1.1 Data Backup Utility  /
echo /--------------------------------------/

if (-e $BFILE) then
	echo Removing existing archive..
	rm -f $BFILE
endif

if (-e $BACKUPDRIVE/`/bin/date '+%m%d%y'`$BFILE.gz) then
	echo Removing existing compressed archive for today..
	rm -f $BACKUPDRIVE/`/bin/date '+%m%d%y'`$BFILE.gz
endif

echo Files will be added to  $BFILE
echo -n 'Archiving..  user data files..'
tar cf $BFILE users
echo                              DONE!
echo -n '             alert files..'
tar uf $BFILE alertdir
echo                              DONE!
echo -n '             gag files..'
tar uf $BFILE gagdir
echo                              DONE!
echo -n '             mail files..'
tar uf $BFILE maildir
echo                              DONE!
echo -n '             profile files..'
tar uf $BFILE prodir
echo                              DONE!
echo -n '             user macros..'
tar uf $BFILE macrodir
echo                              DONE!
echo -n '             restrict files..'
tar uf $BFILE restrict
echo                              DONE!
echo -n '             new-restricts..'
tar uf $BFILE newrestrict
echo                              DONE!
echo -n '             library..'
tar uf $BFILE lib
echo                              DONE!
echo -n '             help files..'
tar uf $BFILE helpfiles
echo                              DONE!
echo -n '             user warnings..'
tar uf $BFILE warnings
echo                              DONE!
echo -n '             configs..'
tar uf $BFILE config
echo                              DONE!
echo -n '             code..'
tar uf $BFILE *.h *.c README restart Makefile
echo                              DONE!
echo Done archiving
echo Compressing archive to.. $BACKUPDRIVE/`/bin/date '+%m%d%y'`$BFILE.gz
gzip -9 $BFILE
mv $BFILE.gz $BACKUPDRIVE/`/bin/date '+%m%d%y'`$BFILE.gz
echo Backup complete!



