Selasa, 18 Ogos 2009

Weekly Backup


#!/bin/sh
# This backup script should be run weekly.
export PATH=/usr/bin:/bin:/sbin:/usr/sbin
# Define where you want to backup.
DEST=/net/nas/backup/pepe
# Check for NFS mount to ensure we got the mount point
ls /net/nas/backup > /dev/null 2>&1
if [ ! -d $DEST ]; then
echo "Directory not found: $DEST"
exit 1
fi
function copythis () {
RSOPTS="-ax --delete --numeric-ids --delete-excluded --bwlimit=30000"
FROM="$1"
shift
TO="$1"
shift
XOPTS="$*"
echo $FROM to $TO
rsync $RSOPTS $XOPTS $FROM $TO
}
copythis /home/bb $DEST/home/
copythis /root $DEST/
copythis /var/lib/mysql $DEST/
copythis /var/named $DEST/
copythis /var/www $DEST/
copythis /etc $DEST/

Tiada ulasan:

Catat Ulasan