| Hello callaga:
Here is one of my scripts I use to backup the etc directory on my servers:
#!/bin/bash
# Set a value that we can use for a datestamp
DATE=`date +%Y-%m-%d`
# Our Base backup for home directories
BOX="serverIP"
BASEBACKUP="/opt/backup-dir/$BOX/full-backups/etc"
# This is where we throw our backups.
# Test to see if our backup directory exists.
# If not, create it.
if [ ! -d $BASEBACKUP ]
then
mkdir -p $BASEBACKUP
fi
tar cvzpf etc-$DATE.tar.gz /etc
mv etc-$DATE.tar.gz $BASEBACKUP
Just change "serverIP" for either your server's IP or its host name.
This script does a full backup of this directory.
The next one is for incremental backups of this directory:
#!/bin/bash
DATE=` /bin/date +%m%d%Y-%H%M`
find /etc -type f -mtime -1 | xargs \
tar cvzpf
/opt/backup-dir/serverIP/incremental-backups-$DATE.tar.gz
The script for incremental backups backs up all the files that have changed in the /etc directory within the past 24 hours.
I hope this helps.
__________________
Thanks.
--Willie
If there was no Linux, my life would not be complete.
|