On Wed, Dec 09, 2009 at 10:57:13AM -0800, Omid wrote:
[...]
> the idea is to schedule an rsync command to an external drive say every
> wednesday morning at 3 am, instruct the office to plug the drive in on
> tuesday, and to replace it on thursday with next week's drive.
>
> i have the rsync command down pat. i'm using:
>
> rsync -aHPp /data/ /mnt/usb/data/
>
> i've realized that the trailing backslash is important <smile>. to be
> consistent anyways.
>
> i've gotten the cronjob down pat, including the mount, stop and umount
> commands. what i'm having problems with is this.
>
> if the usb drive does not mount for whatever reason (either because it
> hasn't been plugged in, or for another reason), the copy is going to go to
> the folder that's there, which is going to fill up the native drive very
> quickly.
>
> how can i avoid this?
> i've tried the --no-dir command in rsync, hoping that it would prevent rsync
> from happening if the destination folder doesn't exist. but it doesn't seem
> to work.
>
> the only other option i seem to have is to create a script that confirms
> that the mount has occurred before executing the rsync script. got any
> idea's?
Just create a file called "THIS_IS_THE_USB_DRIVE" on the drive itself,
then let your cronjob check for it like this:
[ -f /mnt/usb/THIS_IS_THE_USB_DRIVE ] && rsync -aHPp /data/ /mnt/usb/data/
Of course, a script would be suitable - it might mail somebody, then
"while [ ! -f /mnt/usb/THIS_IS_THE_USB_DRIVE ] ; do sleep 1m ; done"
to wait for the drive to appear.
HTH,
Tino.
--
"What we nourish flourishes." - "Was wir nähren erblüht."
www.lichtkreis-chemnitz.de
www.tisc.de
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
|