LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   backup laptop with rsync: online check (https://www.linuxquestions.org/questions/linux-newbie-8/backup-laptop-with-rsync-online-check-779074/)

unihiekka 12-31-2009 09:14 AM

backup laptop with rsync: online check
 
Hi!

I am writing my own anacron script that backs up my most important files from my laptop to my office pc regularly using rsync. However, sometimes my laptop is on when anacron starts the back-up job but my laptop is offline, so that it cannot rsync with my desktop. Is it possible to tell anacron to re-schedule the task to either the next time I'm online again or to some later date (preferably not the next scheduled time, but some time before)?

Thanks.

briealeida 12-31-2009 09:21 AM

You could possibly tell it to sleep, say, 1 hour and then try again.

Syntax for the sleep command is here:

http://ss64.com/bash/sleep.html

unihiekka 01-01-2010 06:07 AM

Thought about that one, but the problem is that I'm sometimes in the train working without being online, so that the sleep command would not help very much, because afterwards it's switched off again. Thanks, though.

GooseYArd 01-01-2010 06:36 AM

you could have the script touch a file when it completes, then schedule the cron job to run every 5 minutes, but not to do anything unless the file you touched is more than n hours old.

unihiekka 01-01-2010 07:10 AM

Thanks, I'll try that one!


All times are GMT -5. The time now is 12:58 AM.