Hi Stephen,

I obviously didn't make myself clear enough.

I have one disk dedicated to backups.

This is the backup script my-rsync, which I put in /usr/local/bin:
#======================================================================
#! /bin/bash
# /usr/local/bin/my-rsync
#######################
# Backup Script
#######################

BACKUP_TO=/mnt/backup
EXCLUDE=/usr/local/bin/rsync-exclude

echo "   Mounting boot partition..."
mount /boot -o ro
echo
echo "   Mounting backup disk..."
mount $BACKUP_TO
sleep 4
echo
echo "   Performing backup..."
echo
rsync --progress --delete -av --exclude-from=$EXCLUDE / \
        $BACKUP_TO/rsync/

echo
echo "   Unmounting boot and backup partitions..."

/bin/umount -l /boot
/bin/umount -l $BACKUP_TO

echo
echo "   Spinning down backup disk..."
/sbin/hdparm -y /dev/hdc                # spin down disk
#======================================================================

As root, I did:
chmod a+x /usr/local/bin/my-rsync
...to make the script executable

In the script you'll see "EXCLUDE=/usr/local/bin/rsync-exclude".  This 
means that you list all the files you want to exclude from the backup 
in a file you create (I called mine rsync-exclude and put it in 
/usr/local/bin).  See `man rsync` for more information.

My /usr/local/bin/rsync-exclude looks like this:
#======================================================================
- /tmp/
- /var/lib/init.d/
- /mnt/backup/
- /mnt/cdrom/
- /mnt/floppy/
- /proc/
- /usr/portage/distfiles/
- /root/.ccache/
- /home/peter/.ccache/
#======================================================================

As Andrew Farmer suggested, you can use /etc/cron.daily to have it run 
automatically.  Before you do so, run it manually to make sure it works 
for you, altering the mountpoint ($BACKUP_TO) and /dev/hdc in the "spin 
down disk" part to suit your installation.  My /etc/fstab entry for 
$BACKUP_TO reads:
/dev/hdc1 /mnt/backup ext3 noauto,noatime,users 0 0
...so, like /boot, it's only mounted when needed.

When you are ready to add the backup script to cron.daily, become root 
and do:
cp /usr/local/bin/my-rsync /etc/cron.daily/

Hope this helps you.

Peter
-- 
======================================================================
Gentoo: Portage 2.0.48-r5 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1)
kernel-2.4.22_pre2-gss i686 AMD Athlon(tm) XP 1600+
======================================================================


--
[EMAIL PROTECTED] mailing list

Reply via email to