[Klug-general] rsync and usb

Alan at comm-tech alan at communitytechnology.org.uk
Mon Sep 26 08:13:58 UTC 2011


On 25/09/11 23:20, sharon kimble wrote:
> I use rsync to back up my /home to an external hard drive using usb.  Thiis 
> the stanza;= /usr/bin/rsync -av /home/boztu/ /media/disk/`/bin/date +%Y%m%d`/ 
>>> /home/boztu/cron/backup.txt
> But occasionally when I plug the drive in after a reboot, it comes up with ;= 
> /usr/bin/rsync -av /home/boztu/ /media/usb/`/bin/date +%Y%m%d`/ >> 
> /home/boztu/cron/backup.txt
>
> How can I add the second line to my backup.sh file such that it will run from 
> either stanza please?
before the rsync commands you could use
mount |grep usb to test whether it mounted there
more reliable is to use
e2label which will name the USB and therefore define how automount
handles it
blkid is also a useful  command







More information about the Kent mailing list