[Klug-general] rsync and usb
David Halliday
david.halliday at gmail.com
Mon Sep 26 07:46:29 UTC 2011
Good morning,
Looking at the two commands:
/usr/bin/rsync -av /home/boztu/ */media/disk/*`/bin/date +%Y%m%d`/ >>
/home/boztu/cron/backup.txt
/usr/bin/rsync -av /home/boztu/ */media/usb/*`/bin/date +%Y%m%d`/ >>
/home/boztu/cron/backup.txt
The only difference i can see is the name of the directory where the device
is mounted. This might be a case of checking the fstab:
http://www.tuxfiles.org/linuxhelp/fstab.html
Te enable both of these to run (or the right one to run) you can use an if
statement to detect which target directory exists:
if [ -d /media/disk/ ]; then
/usr/bin/rsync -av /home/boztu/ /media/disk/`/bin/date +%Y%m%d`/ \
>> /home/boztu/cron/backup.txt
fi
if [ -d /media/usb/ ]; then
/usr/bin/rsync -av /home/boztu/ /media/usb/`/bin/date +%Y%m%d`/ \
>> /home/boztu/cron/backup.txt
fi
On 25 September 2011 23:20, sharon kimble <boudiccas at talktalk.net> 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?
>
> Take care
> Sharon.
> --
> A taste of linux = http://www.sharons.org.uk/taste/index.html
> efever = http://www.efever.blogspot.com/
> efever = http://sharon04.livejournal.com/
> Debian 6,0.2, KDE 4.4.5, LibreOffice 3.4.3
> Registered Linux user 334501
>
> _______________________________________________
> Kent mailing list
> Kent at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/kent
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/kent/attachments/20110926/28ebf1a6/attachment.htm>
More information about the Kent
mailing list