What follows is a nice shell script that is used for backing up
important directories. If you create a /bkup directory on a separate
drive, this can be used to recover from a hard drive crash. Add this
script to the crontab to run a backup every night and your in business.
And change/add directories on the bottom. It rotates the directories
around and removes the oldest up to 7 days. Simple, yet handy. :)
-Rob.
# daily_bkup.sh
cd /bkup/
if [ -d backup.6 ]; then rm -fR backup.6; fi
if [ -d backup.5 ]; then mv -f backup.5 backup.6; fi
if [ -d backup.4 ]; then mv -f backup.4 backup.5; fi
if [ -d backup.3 ]; then mv -f backup.3 backup.4; fi
if [ -d backup.2 ]; then mv -f backup.2 backup.3; fi
if [ -d backup.1 ]; then mv -f backup.1 backup.2; fi
if [ -d backup.0 ]; then mv -f backup.0 backup.1; fi
if [ -d backup ]; then mv -f backup backup.0; fi
dir="/bkup/backup"
mkdir $dir
nice -20 tar cfz ${dir}/htdocs.tar.gz /usr/local/apache/htdocs
nice -20 tar cfz ${dir}/mysql.tar.gz /var/db/mysql
nice -20 tar cfz ${dir}/etc.tar.gz /etc