Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-08-2009, 06:44 AM   #1
Registered: Dec 2008
Location: Ireland
Distribution: Ubuntu 8.10
Posts: 45

Rep: Reputation: 15
rsync and cron

hello everyone
I'm trying to setup my backup

I was thinking of writing a script like
sudo rsync -av MYUSERNAME /media/BACKUPDISK/rsync

then put it into cron daily

would it make sense?
What happens if my external hard drive is not connected?
What time does the daily cron start?

Is it possible to make a script so that my backup runs whenever I connect my ext HD, unless its been run in the last hour? Can you point me in the right direction? No need for a tutorial if you're in a hurry, a webpage will do

Thanks a lot!
Old 01-08-2009, 06:54 AM   #2
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
What time does the daily cron start?
You can set cron at the hour you want
see man cron

sudo rsync -av MYUSERNAME /media/BACKUPDISK/rsync
nake a cronjob for the user
you can make a cronjob for the user
as user:
crontab -e

You can add a verification to your script to see if the drive is connected at the time the script is executed.

# Lets see ithe HD is connected, if not quit
if mount | grep BACKUPDISK > /dev/null
rsync -av /media/BACKUPDISK/rsync
echo "No or wrong external HD connected"
echo "Please verify"
echo "Nothing to do here, so quitting"
exit 1


cron, rsync

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need coaching with RSync and cron configuration on Ubuntu mkenyon2 Linux - Software 4 12-17-2008 03:09 AM
Auto RSYNC Over SSH via Cron? carlosinfl Linux - General 1 09-10-2007 02:12 PM
Cannot execute rsync as a cron job jdaniels73 Linux - Software 2 09-03-2006 05:03 AM
how do I rsync & cron to fetch -current weekly? chess Slackware 3 09-11-2005 10:07 AM
using rsync with cron & pub. key kmitz Fedora 0 01-14-2005 08:01 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:27 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration