Also, it is to be noted that I cannot remote sql client connect to the server with that username. So I have to copy of the sql file and execute it there remotely only. Hence the GNU sql may not help here.
________________________________ From: p sena <[email protected]> To: Ole Tange <[email protected]> Cc: "[email protected]" <[email protected]> Sent: Wednesday, July 10, 2013 10:15 PM Subject: Re: help on remote ssh cmd 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 <[email protected]> To: p sena <[email protected]> Cc: "[email protected]" <[email protected]> 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 <[email protected]> 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
