Re: How to do two or more rsyncs with one password?

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: keith smith
Date:  
To: Main PLUG discussion list
Subject: Re: How to do two or more rsyncs with one password?

Hi Joe,

Here is a shell script I inherited.  Probably someone before me found it on a website for all I know.  I do not fully understand it however just modify the rsync= line, modify the paths= area, and replace ServerNameGoesHere with the destination server.  You may want to remove the MySql part.

I'm guessing this works because there is a key in place already.


#!/bin/bash

# sync content to off-site systems

[ -t 1 ] && v=vP
rsync=( rsync -az$v -e "ssh -p 22" --bwlimit=2000 --delete-after )

paths=(
        /home                   # main thing to get sync'd
        /etc/php.ini            # what if php.d is out of sync?
#       /etc/php.d              # sync via yum somehow?
#       /var/lib/mysql          # use replication instead
        /var/www/html           # nothing here usually
        /var/www/cgi-*          # cgiwrap and phpwrap
#       /var/lib/php/session    # sessions will break anyway
)

for path in "${paths[@]}"
do
        [ -t 1 ] && echo "$path"
        "${rsync[@]}" "$path" ServerNameGoesHere:"${path%/*}/" & [ -t 1 ] && wait
done

# sync mysql to a backup folder (replication normally handles it)
[ -t 1 ] && echo /var/lib/mysql
"${rsync[@]}" /var/lib/mysql/ ServerNameGoesHere:/var/lib/mysql-rsync/

wait
[ -t 1 ] ||
while pgrep -x rsync >/dev/null
do
  echo rsync still running!
  sleep 10
done







------------------------

Keith Smith

--- On Mon, 8/16/10, <> wrote:

From: <>
Subject: Re: How to do two or more rsyncs with one password?
To: "Main PLUG discussion list" <>
Date: Monday, August 16, 2010, 8:19 AM


On 08/15/2010 01:23 PM, wrote:
How can one do two or more rsyncs with entering the password just once?

Brian Cluff replied:
> ... do it with just one rsync call:
>
> rsync -avHp --progress subdir1 subdir2 subdir3
> :www/


Thanks Brian. That is exactly what I was looking for.

> ... if you need to copy into several different destination
> directories, set up a shared key for ssh and copy the public key
> over to the destinations authorized_keys file.


That is also a very helpful suggestion (others have recommended),
but just haven't got it done yet.



---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss



---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss