merge documents with scp

kitepilot at kitepilot.com kitepilot at kitepilot.com
Sat May 5 05:16:01 MST 2012


First of all, you need to understand what the '*' and '?' characters are 
doing for your line, how, and when.
When you type a command and hit <ENTER>, the shell will 'glob' the command 
before it passes it to the interpreter.
What that means is that 'what you see' is NOT 'what you get'.
You can read about it in:
http://en.wikipedia.org/wiki/Glob_(programming) 

Then inspect what glob(ing) will do for you, try:
echo /home/*   #  <= NO QUOTES! 

You can have as many arguments as you want on an 'rsync' (or cp) command, 
which implies that everything will be copied to the last directory (RTFM). 

If you have directories
/home/xyz1
/home/xyz2
/home/xyz3
/home/xyz4
/home/xyz5 

And you say:
rsync -a /home/xyz*
this will 'glob' to:
rsync -a /home/xyz1 /home/xyz2 /home/xyz3 /home/xyz4 /home/xyz5 

which will copy the content of the directories /home/xyz{1.2.3.4} to 
/home/xyz5
Probably not what you expected... (or wanted) 

When you say:
<user2>@address2>/home/xyz*
You intent to 'glob' the remote directory, but 'glob' will happen before the 
line is executed and the remote box will be unavailable then, so it will 
'glob' the local box and (if you are lucky) you'll get an error (if you are 
unlucky you'll break something) 

Finally look at the rsync syntax and then break this line:
> rsync -aHv <user1>@<address1>:/home/xyz*/ /home/xy* <user2>@address2>/home/xyz*
into components...
See if the components will fit the syntax (they won't). 

Remember, for every problem there is always an obvious, direct and wrong 
solution.
Watch your step...
ET 

 

Michael Havens writes: 

> I just thought of something the only thing different about the two is the
> last digit. say xyz1 and xyz2. Could I do something like ' 
> 
>   rsync -aHv <user1>@<address1>:/home/xyz*/ /home/xy*
> <user2>@address2>/home/xyz* 
> 
> ?????????????????????????????????? 
> 
> 
> On Fri, May 4, 2012 at 8:12 PM, Michael Havens <bmike1 at gmail.com> wrote: 
> 
>> boy am I lucky.... I didn't run out of room. okay.... I need to rsync two
>> /home directories.  The thing is the two directories are named differently
>> at the top. one is /home/x and one is /home/y I want everything under  x to
>> look like y. I looked in the man page and I thought I found something but
>> then I looked on and couldn't find it again to investigate further. I
>> thought it was in the 'running as a daemon' section but I couldn't find it
>> again. 
>>
>>
>> On Sun, Apr 29, 2012 at 4:18 AM, kitepilot at kitepilot.com <
>> kitepilot at kitepilot.com> wrote: 
>>
>>> how would I rsync just what has been modified?
>>>>
>>>
>>> If I interpret this question as:
>>> 'how would rsync know just what has been modified?'
>>> The answer is: it depends.
>>> rsync will compare timestamps unless you use the --checksum option.
>>> RTFM...
>>> If I interpret this question as:
>>> 'how would I know just what rsync has updated?'
>>> You don't, you trust rsync.
>>> I you don't trust rsync (I don't), you can run it twice with the
>>> --checksum option (I do) or you can:
>>> ssh user at box 'cd my-path;find . -type f -exec md5sum "{}" \;|sort' >
>>> /tmp/remote.md5
>>> cd my-path;find . -type f -exec md5sum "{}" \;|sort > /tmp/local.md5
>>> sdiff -s /tmp/remote.md5 /tmp/local.md5
>>> Ang get your banana...   :)
>>> Good luck...
>>> ET
>>> PS: Free advice, you can't sue me...   :) 
>>>
>>> 
>>>
>>> Michael Havens writes: 
>>>
>>>> thanks. this is  takling a long time..... how would I rsync just what has
>>>> been modified?
>>>> On Fri, Apr 27, 2012 at 1:51 PM, Nathan England <nathan at nmecs.com>
>>>> wrote: 
>>>>
>>>>> ** 
>>>>>
>>>>> You need to use rsync 
>>>>>
>>>>>
>>>>> rsync -av /path/to/localfile user at remotehost:/path/to/**remotefile 
>>>>>
>>>>>
>>>>> or alternatively 
>>>>>
>>>>>
>>>>> rsync -av user at remotehost:/path/to/**remotefile /path/to/localfile 
>>>>>
>>>>> 
>>>>>
>>>>> 
>>>>>
>>>>> 
>>>>>
>>>>> 
>>>>>
>>>>> 
>>>>>
>>>>> 
>>>>>
>>>>> On Friday, April 27, 2012 13:46:40 Michael Havens wrote:
>>>>> thanks for the quick responses.... what I meant is like to have
>>>>> duplicate
>>>>> files on two systems and then make the files the same.
>>>>> On Fri, Apr 27, 2012 at 1:07 PM, Carruth, Rusty <
>>>>> Rusty.Carruth at smartstoragesys.**com <Rusty.Carruth at smartstoragesys.com>>
>>>>> wrote:
>>>>> Fast answer: 
>>>>>
>>>>>
>>>>> ssh me at foosystem ‘cat the_Remote_file’ >> localfile 
>>>>>
>>>>>
>>>>> Explanation: 
>>>>>
>>>>>
>>>>>                On system ‘foosystem’ (as me), cat the file.  On this
>>>>> system, append that stream of bytes to ‘localfile’. 
>>>>>
>>>>>
>>>>> Should you want to ‘tail –f’ the file on ‘foosystem’, change ‘cat’ to
>>>>> ‘tail –f’.  (Or grep, or …) 
>>>>>
>>>>>
>>>>> Rusty 
>>>>>
>>>>>
>>>>> . 
>>>>>
>>>>>
>>>>> From: plug-discuss-bounces at lists.**plug.phoenix.az.us<plug-discuss-bounces at lists.plug.phoenix.az.us>[mailto:
>>>>> plug-discuss-bounces at lists.**plug.phoenix.az.us<plug-discuss-bounces at lists.plug.phoenix.az.us>]
>>>>> On Behalf Of Michael Havens
>>>>> Sent: Friday, April 27, 2012 1:05 PM
>>>>> To: Main PLUG discussion list
>>>>> Subject: merge documents with scp 
>>>>>
>>>>>
>>>>> is there a way to tell scp to add any appended text to an existing
>>>>> document? (that's called 'merge', right?)
>>>>> --
>>>>> :-)~MIKE~(-: 
>>>>>
>>>>> ------------------------------**---------------------
>>>>> PLUG-discuss mailing list - PLUG-discuss at lists.plug.**phoenix.az.us<PLUG-discuss at lists.plug.phoenix.az.us>
>>>>> To subscribe, unsubscribe, or to change your mail settings:
>>>>> http://lists.PLUG.phoenix.az.**us/mailman/listinfo/plug-**discuss<http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss> 
>>>>>
>>>>> 
>>>>>
>>>>> --
>>>>> :-)~MIKE~(-: 
>>>>>
>>>>>
>>>>> -- 
>>>>>
>>>>> 
>>>>>
>>>>> Regards, 
>>>>>
>>>>>
>>>>> Nathan England 
>>>>>
>>>>>
>>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**~~~~~~~~~~~
>>>>> NME Computer Services http://www.nmecs.com
>>>>> Nathan England (nathan at nmecs.com)
>>>>> Systems Administration / Web Application Development
>>>>> Information Security and Consulting
>>>>> (480) 559.9681 
>>>>>
>>>>> 
>>>>>
>>>>>
>>>>> ------------------------------**---------------------
>>>>> PLUG-discuss mailing list - PLUG-discuss at lists.plug.**phoenix.az.us<PLUG-discuss at lists.plug.phoenix.az.us>
>>>>> To subscribe, unsubscribe, or to change your mail settings:
>>>>> http://lists.PLUG.phoenix.az.**us/mailman/listinfo/plug-**discuss<http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss> 
>>>>>
>>>> 
>>>>
>>>> --
>>>> :-)~MIKE~(-: 
>>>>
>>> ------------------------------**---------------------
>>> PLUG-discuss mailing list - PLUG-discuss at lists.plug.**phoenix.az.us<PLUG-discuss at lists.plug.phoenix.az.us>
>>> To subscribe, unsubscribe, or to change your mail settings:
>>> http://lists.PLUG.phoenix.az.**us/mailman/listinfo/plug-**discuss<http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss> 
>>>
>> 
>>
>>
>> --
>> :-)~MIKE~(-: 
>>
>  
> 
> 
> -- 
> :-)~MIKE~(-:


More information about the PLUG-discuss mailing list