parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help on remote ssh cmd


From: Ole Tange
Subject: Re: help on remote ssh cmd
Date: Thu, 11 Jul 2013 20:13:25 +0200

Please use parallel@gnu.org for support unless you want to hire me as
consultant.

For quoting please read http://www.gnu.org/software/parallel/man.html#quoting
and read about --shellquote.

/Ole

On Thu, Jul 11, 2013 at 7:06 PM, p sena <senapati2001@yahoo.com> wrote:
> Thanks Ole.     This worked.
>
> $cat host |parallel -j2 rsync -Hav /home/User/xxx.sql {}:/home/User/xxx.sql
> \;ssh {} hostname \\\&\\\& '/bin/mysql --user=root --password=password DB
> \</home/User/xxx.sql'
>
> I have the single quote (') in the mysql command. I think if I don't use
> single quote than I have to do \\\\\\< . How do I understand more
> (references, code, pointers etc) on the \\\\ things how to be used and where
> in this parallel world ?
>
>  Thanks.
>
> ----- Original Message -----
> From: Ole Tange <tange@gnu.org>
> To: p sena <senapati2001@yahoo.com>
> Cc:
> Sent: Thursday, July 11, 2013 5:22 PM
> Subject: Re: help on remote ssh cmd
>
> You need to be more careful with your quoting:
>
> "\\\&" is not the same as \\\&
>
> This is tested:
>
>   echo server | parallel rsync -Hav myfile {}:\;ssh {} hostname
> \\\&\\\& cat \\\\\<myfile
>
> So this ought to work:
>
>   cat host | parallel -j2 rsync -Hav /home/User/xxx.sql
> {}:/home/User/xxx.sql\;ssh {} hostname \\\&\\\& /bin/mysql --user=root
> --password=password DB \\\\\</home/User/xxx.sql
>
> All the \\-hell is the reason why --onall was made.
>
>
> /Ole
>
> On Wed, Jul 10, 2013 at 6:45 PM, p sena <senapati2001@yahoo.com> wrote:
>>
>> Ole ,
>>
>> This does not work.
>>
>> cat host |parallel -j2 rsync -Hav /home/User/xxx.sql {}:/home/User/xxx.sql
>> \;"ssh {} hostname \\\&\\\& /bin/mysql --user=root --password=password DB
>> </home/User/xxx.sql"
>> sh: ./\: Permission denied
>> sh: /home/User/xxx.sql: No such file or directory
>> building file list ... done
>>
>> sent 92 bytes  received 20 bytes  20.36 bytes/sec
>> total size is 677  speedup is 6.04
>> sh: ./\: Permission denied
>> sh: /home/User/xxx.sql: No such file or directory
>> building file list ... done
>>
>> sent 92 bytes  received 20 bytes  20.36 bytes/sec
>> total size is 677  speedup is 6.04
>>
>> If i remove the " near the ssh {} then also it fails saying that file
>> xxx.sql not found (on localhost). I see the file is rsynced. but command
>> fails to run.
>>
>> thanks.
>>
>> ----- Original Message -----
>> From: Ole Tange <tange@gnu.org>
>> To: p sena <senapati2001@yahoo.com>
>> Cc: "parallel@gnu.org" <parallel@gnu.org>
>> Sent: Tuesday, July 9, 2013 10:58 PM
>> Subject: Re: help on remote ssh cmd
>>
>> On Tue, Jul 9, 2013 at 5:58 AM, p sena <senapati2001@yahoo.com> wrote:
>>
>>> Seemed both the commands didn't worked ? But the way I showed you it
>>> worked
>>> ( parallel -j 1 --basefile some-file-2-copy  -S H1,H2 ::: "hostname &&
>>> /home/username/that-file-copied" "hostname &&
>>> /home/username/that-file-copied") , is that way Ok, is it doing the
>>> things
>>> parallel ?
>>
>> -j1 forces to run one job per host.
>>
>> While the above will probably run  "hostname &&
>> /home/username/that-file-copied" on both, that is not necessarily true
>> if you have many hosts: If the command finishes on H1 before GNU
>> Parallel gets the command started on H100, then GNU Parallel may start
>> it on H1 instead.
>>
>> So what you are doing does not scale and may cause problems.
>>
>> This guarantees what you want:
>>
>> cat hosts.txt | parallel -j10 rsync -Hav
>> /home/username/that-file-copied {}:/home/username/that-file-copied \;
>> ssh {} hostname \\\&\\\& /home/username/that-file-copied
>>
>>
>> /Ole
>>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]