Re: rsync --delete
On Wednesday 07 June 2006 23:51, Dexter wrote:
> Hi,
> i use "rsync -rlptgov --delete /mnt/server/dir/ /var/share/server/dir"
> comand to sinchronize directory on backup server with primary server. I
> use --delete option, so that files, that do not exist on SRC are deleted
> also on DST. SRC directory is mounted through NFS on backup server.
> Acording to manual, rsync should not delete any files if there are any
> I/O errors, to prevent masive deletion. But masive (whole tree) deletion
> happened to me, when SRC directory was not mounted and directory
> "/mnt/server/dir/" was empty.
> Do you know some way to evoid this to happen?
> Thanks alot.
> Dexter
You'll need to put a check in your script to make sure your NFS directory is
mounted. Something like this will work:
if mount|grep -q '/mnt/BackupDrive';
then
echo 'Backup Already Mounted';
else
echo 'Mounting Backup';
if mount /mnt/BackupDrive;
then
echo 'Backup Mounted';
else
echo 'BackupDrive failed to mount. Exiting.';
exit 1;
fi;
fi;
j
--
Joshua Kugler
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE
PO Box 80086 -- Fairbanks, AK 99708 -- Ph: 907-456-5581 Fax: 907-456-3111
Reply to: