-   Linux - Newbie (
-   -   Stacking rsync commands (

Seventh 07-15-2012 05:59 PM

Stacking rsync commands
Hi folks,

Not sure if this belongs in the newbie or the server section, so my apologies if this is the wrong place.

I have a webserver that I backup using a handful of rsync scripts that I run under OSX. They're pretty basic, and just sync a few directories in various parts of the filesystem.

Right now, I have to run them separately, since (for example) one backs up something under /home/user/website/stuff_to_be_backedup, while another backs up something under /home/someotheruser/someotherstuff

Since the rsync script is authenticating to the server, is there a way to get it to backup multiple sections? Right now I just run four copies of the script and authenticate each time, but I assume there's probably a way (that my Google-fu fails to find) that I can have it log in, rsync the first bit, then the second, then so-on without having to log in/out each time.

Any insight would be great. :) Cheers!

rknichols 07-15-2012 07:05 PM

If you have an ssh authentication agent running in your login session, you can run ssh-add to add identities to the agent and they will be available to rsync without further authentication. ssh-agent is generally started automatically in a X session. If you're logging in from a text terminal, you'd probably need to run

eval $(ssh-agent -s)
to start the agent and set up the needed environment variables. You can see the manpages for ssh-agent and ssh-add for more details than you probably wanted to know.

TobiSGD 07-15-2012 07:09 PM

You can also use key-based authentication, this way you don't have to give your password/username at all and can automate the backup with cron (or whatever MacOS X uses instead).

Seventh 07-28-2012 09:35 AM

Thanks very much guys!

I was able to use this tutorial here:

And it worked perfectly. Much appreciated!

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