There are a lot of examples available if you google for rsync tutorial or rsync 
examples.   Search for examples of using rsync for backups. 

You may need to specify the source path, /, and the destination path, /.  If 
you are rsync'ing everything, then /data should be included by default.  That 
assumes that your destination paths are identical to the source.  You said that 
the destination is different than the source  so you need to consider the 
exclude option.  Excludes can be specified individually or in a file.  The 
syntax is going to vary slightly with the OS and version of rsync.   The 
trailing "/" is critical in determining where everything ends up.  

The general rsync syntax looks like this:
        rsync <options> source destination

So your syntax is going to look something like this.  I threw in some options 
you may want to consider such as stats, and others that are a must for a backup 
such as the -a and -l options.  The - a option is for archive.  It equals a 
group of other individual options.  The -l option is to copy symlinks.
        rsync -al  --ignore-errors --stats --delete --exclude="data" / 
root@foo:/

There are a lot of options for rsync.  Take a look at the man page for rsync.  
.  You need to test to see which ones you want.

If you are going to run multiple rsync commands from cron, then just write a 
simple script that executes the rsync commands.  You need to do this is if the 
rsync commands are to be executed sequentially.  Running multiple rsync 
commands simultaneously can be a resource hog.  If you want to things 
simultaneously, I suggest that you test by running manually before trying it 
from cron.

I suggest that you test your syntax manually before trying to run it from cron. 
 


Cathy 


-- 
Cathy L. Smith
IT Engineer

Pacific Northwest National Laboratory
Operated by Battelle for the 
U.S. Department of Energy

Phone: 509.375.2687
Fax:       509.375.4399
Email: cathy.sm...@pnnl.gov

-----Original Message-----
From: plug-boun...@pdxlinux.org <plug-boun...@pdxlinux.org> On Behalf Of Rich 
Shepard
Sent: Thursday, November 15, 2018 7:53 AM
To: plug@pdxlinux.org
Subject: [PLUG] rsync in a cron job

   I want to update ~/ on the new desktop with changes made in ~/ on the old 
desktop using rsync in a daily cron job. The old desktop has a directory ~/data 
while the newdesktop has a /data partition separate from /home.

   There is an --exclude option to rsync and I'm not sure where it should go in 
the command line. Is this correct if run from my crontab?

rsync salmo: --exclude=data .

   Would a separate rsync command be needed to copy changes from salmo:data/ to 
baetis:/data or could both be accomplished with the same command?

TIA,

Rich
_______________________________________________
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug
_______________________________________________
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to