Good morning,<div><br></div><div>Looking at the two commands:</div><div><span class="Apple-style-span"><div><font class="Apple-style-span" face="'courier new', monospace">/usr/bin/rsync -av /home/boztu/ <b>/media/disk/</b>`/bin/date +%Y%m%d`/ >> /home/boztu/cron/backup.txt</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">/usr/bin/rsync -av /home/boztu/ <b>/media/usb/</b>`/bin/date +%Y%m%d`/ >> /home/boztu/cron/backup.txt</font></div><div><br></div><div>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: <a href="http://www.tuxfiles.org/linuxhelp/fstab.html">http://www.tuxfiles.org/linuxhelp/fstab.html</a></div>
<div><br></div><div>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:</div><font class="Apple-style-span" face="'courier new', monospace">if [ -d /media/disk/ ]; then<br>
/usr/bin/rsync -av /home/boztu/ /media/disk/`/bin/date +%Y%m%d`/ \</font></span></div><div><span class="Apple-style-span"><font class="Apple-style-span" face="'courier new', monospace"> >> /home/boztu/cron/backup.txt<br>
fi</font></span></div><div><span class="Apple-style-span"><font class="Apple-style-span" face="'courier new', monospace"><br>if [ -d /media/usb/ ]; then<br> /usr/bin/rsync -av /home/boztu/ /media/usb/`/bin/date +%Y%m%d`/ \</font></span></div>
<div><span class="Apple-style-span"><font class="Apple-style-span" face="'courier new', monospace"> >> /home/boztu/cron/backup.txt<br>fi</font></span></div><div><br><div class="gmail_quote">On 25 September 2011 23:20, sharon kimble <span dir="ltr"><<a href="mailto:boudiccas@talktalk.net">boudiccas@talktalk.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I use rsync to back up my /home to an external hard drive using usb. Thiis<br>
the stanza;= /usr/bin/rsync -av /home/boztu/ /media/disk/`/bin/date +%Y%m%d`/<br>
>> /home/boztu/cron/backup.txt<br>
<br>
But occasionally when I plug the drive in after a reboot, it comes up with ;=<br>
/usr/bin/rsync -av /home/boztu/ /media/usb/`/bin/date +%Y%m%d`/ >><br>
/home/boztu/cron/backup.txt<br>
<br>
How can I add the second line to my backup.sh file such that it will run from<br>
either stanza please?<br>
<br>
Take care<br>
Sharon.<br>
--<br>
A taste of linux = <a href="http://www.sharons.org.uk/taste/index.html" target="_blank">http://www.sharons.org.uk/taste/index.html</a><br>
efever = <a href="http://www.efever.blogspot.com/" target="_blank">http://www.efever.blogspot.com/</a><br>
efever = <a href="http://sharon04.livejournal.com/" target="_blank">http://sharon04.livejournal.com/</a><br>
Debian 6,0.2, KDE 4.4.5, LibreOffice 3.4.3<br>
Registered Linux user 334501<br>
<br>
_______________________________________________<br>
Kent mailing list<br>
<a href="mailto:Kent@mailman.lug.org.uk">Kent@mailman.lug.org.uk</a><br>
<a href="https://mailman.lug.org.uk/mailman/listinfo/kent" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/kent</a><br>
</blockquote></div><br></div>