Re: [LIP] Executing commands on other terminals (ptys).

Ajitabh Pandey <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Organization Unixclinic.Net
Message-ID <[email protected]>
Raj Mathur wrote:
> On Thursday 25 January 2007 14:13, Logu wrote:
>   
>> We have test scripts which should be executed on 3 clients and 2
>> server. Usually we login to each of these machines using ssh and
>> issue the commands on each session. Is it possible to send the
>> commands (as root user) to these terminal sessions from another
>> terminal.
>>     
> Not clear what precisely you need here, but you could try any of:
>
> 1. Use screen, so you only need one physical console to manage 
> multiple terminals, or
>
> 2. Give the commands on the SSH command-line itself, as in:
>
>   ssh user@host 'command1 ; command2' > cmd.out 2>&1
>   
Or you can copy all your scripts on one of your local workstation
(assuming your workstation is a *nix flavor machine with open ssh client
installed) and then execute them remotely as:

cat script.sh | ssh root@target-host

and if there are multiple machines then you can also do:

for host in 'host 1 host 2 host3';do cat script.sh | ssh user@$host;done

One thing to keep in mind though, since the commands will actually be
executed on the remote hosts, if the script(s) are dependent on anything
then that should be present on target server.

Regards.

Ajitabh Pandey

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.