06-26-04 08:05 PM
I wrote a script to do this some time ago:
#! /bin/sh
# note for cretins: reiserfs (my fs) has no lost+found, consider adding
that to exclude if you use extfs! # also note, 2.4 kernel has no /sys.
# also, also note /home might contain gigs of crap ;() and be especially #
mindful of the fact that I use bz2 - you might just want to tar if you #
dont have a supercomputer - like mine. ;()
# exclude these dirs (please ffs customize this line to suit your system!)
# I personally put all my crap on /opt and exclude it. since backups arre
# intended only to backup my _system_ not all my gigs of pr0n.
exclude="proc opt sys mnt backup tmp"
LOGFILE="/var/log/backup"
# creates a file containing the above list
for directory in $exclude `rm -rf /tmp/excludelist.tmp`
do
echo $directory >> /tmp/excludelist.tmp
done
date=`date +%B-%d-%y`
# make a log
echo "($$) Backup Started at" $date "($$)" >> $LOGFILE
echo " " >> $LOGFILE
# back stuff up
tar -cvjpf /backup/$date.tar.bz2 --directory / --exclude-from
/tmp/excludelist.tmp .
# stop logging
echo "($$) Backup Ended at" $date "($$)" >> $LOGFILE
echo " " >> $LOGFILE
# stoppit and tidy up!
rm -rf /tmp/excludelist.tmp
[ Post a follow-up to this message ]
|