On Friday 29 August 2003 02:09 pm, Peter Ruskin wrote:
> On Friday 29 Aug 2003 18:08, Ernie Schroder wrote:
> > On Friday 29 August 2003 06:21 am, Peter Ruskin wrote:
> > > Hi Stephen,
> > >
> > > I obviously didn't make myself clear enough.
>
> <snip>
>
> > Peter,
> > Your script looks like it might do the trick for me. I do have a
> > couple of questions though. How would I adapt it for a remote
> > backup location? /mnt/backup is a normally unmounted disk on my
> > secondary Gentoo box. I have configured passwordless ssh between
> > USER with sudo privledges on the machine to be backed up, to
> > [EMAIL PROTECTED] The way to ssh in to the remote box, mount
> > /mnt/backup and then do the rsync eludes me. I wonder if you might
> > steer me in the right direction.
>
> Sounds like a good idea Ernie. I'm afraid I've never done anything
> like that though, so I can't offer any advice. I suppose you could
> use NFS, with an fstab entry like:
> remotebox:/mnt/backup /mnt/remote/mnt/backup nfs
> user,noauto,rw,rsize=8192,wsize=8192,nolock 0 0
> (all one line)
> ...and an entry in the remote box's /etc/exports like:
> /mnt/backup
> 192.168.0.0/255.255.255.0(sync,insecure,no_root_squash,rw)
>
> Then you wouldn't need to use ssh. (man exports(5))
>
> > The second question is about the rsync command in your script.
> > What does the --delete option do? Does it delete old backups?
> > Forgive me for being a bit dense here, but I'm rather new at
> > scripting.
>
> The script makes a mirror of your system. If you delete any files,
> the rsync "--delete" flag deletes those files on the backup next time
> it's run; otherwise the backup would continually grow (man rsync).
> Downside of this is that you only have the opportunity to recover
> accidentally deleted files (one of the main reasons for having a
> backup, after all) up to the next backup run. This isn't a problem
> for me because I have another backup strategy using tar. I suppose
> you could alter the script so that it only does the delete thing once
> a week, say.
>
> if it's Sunday; then
> rsync --progress --delete -av --exclude-from=$EXCLUDE / \
> $BACKUP_TO/rsync/
> else
> rsync --progress -av --exclude-from=$EXCLUDE / \
> $BACKUP_TO/rsync/
> fi
>
> Pter
I may just have to go that rout but I did try my hand at scripting a
remote rsync using Peter's script as a model.
The script should mount the local /boot and then ssh into
[EMAIL PROTECTED] and mount the backup disk after waiting long enough to open
the connection. After exiting the ssh session, it should perform the
backup and delete any files that have been deleted from the local box.
It excludes files listed in /usr/local/bin/rsync-exclude. After
completing the backup, it should unmount /boot, ssh back into
[EMAIL PROTECTED] and unmount /mnt/backup, spin the disk down and exit ssh
I have made it executable and tried it out. It gets as far as
mounting /boot and ssh'ing into [EMAIL PROTECTED] where it stops. Would
someone with some scripting knowledge take a look at it and see if you
can figure out why it aint working?
#======================================================================
#! /bin/bash
# /usr/local/bin/my-rsync
#######################
# Backup Script
#######################
[EMAIL PROTECTED]:/mnt/backup
EXCLUDE=/usr/local/bin/rsync-exclude
echo " Mounting boot partition..."
sudo mount /boot -o ro
echo
echo " Mounting backup disk..."
ssh [EMAIL PROTECTED]
sleep 5
mount /dev/hdb1 /mnt/backup
exit
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
ssh [EMAIL PROTECTED]
sleep 5
umount /mnt/backup
echo
echo " Spinning down backup disk..."
/sbin/hdparm -y /dev/hdb # spin down disk
exit
--
Regards, Ernie
100% Microsoft and Intel free
--
[EMAIL PROTECTED] mailing list