From: Sujai K. <suj...@ta...> - 2007-05-08 11:45:17
|
Hello everybody., I am new to expect. I want to execute some commands after SSH'ing into a machine say 10.2.3.4. I have written script to automate ssh and that is happening fine. After SSH'ed into the machine it exits from the machine. How to execute a command in the SSH'ed machine. Thanks and Regards., Sujai. |
From: Ken I. <fn...@ua...> - 2007-05-08 17:24:26
|
On Tue, May 08, 2007 at 05:16:40PM +0530, Sujai Kumar wrote: > Hello everybody., > > I am new to expect. I want to execute some commands after SSH'ing > into a machine say 10.2.3.4. I have written script to automate ssh and > that is happening fine. After SSH'ed into the machine it exits from > the machine. How to execute a command in the SSH'ed machine. If all you want to do is issue commands, ssh is capable of doing that directly, e.g., (from a shell prompt): $ ssh 10.2.3.4 tail /var/log/syslog This can be automated by setting up key-based authentication and ssh-agent, e.g., using the keychain utility. IMHO Expect.pm and such are called for when you want to automate interactivity with the remote system, i.e., generate output commands based on the responses seen. Ken -- Ken Irving, fn...@ua..., 907-474-6152 Water and Environmental Research Center Institute of Northern Engineering University of Alaska, Fairbanks |
From: sujai <suj...@ta...> - 2007-05-09 08:17:11
|
Hello ken., I want to execute multiple commands on the ssh'ed machine.I want to execute iperf server. sujai Ken Irving wrote: > > On Tue, May 08, 2007 at 05:16:40PM +0530, Sujai Kumar wrote: >> Hello everybody., >> >> I am new to expect. I want to execute some commands after SSH'ing >> into a machine say 10.2.3.4. I have written script to automate ssh and >> that is happening fine. After SSH'ed into the machine it exits from >> the machine. How to execute a command in the SSH'ed machine. > > If all you want to do is issue commands, ssh is capable of doing that > directly, e.g., (from a shell prompt): > > $ ssh 10.2.3.4 tail /var/log/syslog > > This can be automated by setting up key-based authentication and > ssh-agent, e.g., using the keychain utility. > > IMHO Expect.pm and such are called for when you want to automate > interactivity with the remote system, i.e., generate output commands > based on the responses seen. > > Ken > > -- > Ken Irving, fn...@ua..., 907-474-6152 > Water and Environmental Research Center > Institute of Northern Engineering > University of Alaska, Fairbanks > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > -- View this message in context: http://www.nabble.com/query-tf3709123.html#a10390185 Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. |
From: Roland G. <rgi...@cp...> - 2007-05-09 11:17:30
|
I dont know about iperf server but I would guess that it is not an interactive application and that you only want to execute some programs one after another, is this right? Then you could write a shell script and start that remotely via ssh. Roland On 5/9/07, sujai <suj...@ta...> wrote: > > Hello ken., > I want to execute multiple commands on the ssh'ed machine.I > want to execute iperf server. > sujai > > > Ken Irving wrote: > > > > On Tue, May 08, 2007 at 05:16:40PM +0530, Sujai Kumar wrote: > >> Hello everybody., > >> > >> I am new to expect. I want to execute some commands after SSH'ing > >> into a machine say 10.2.3.4. I have written script to automate ssh and > >> that is happening fine. After SSH'ed into the machine it exits from > >> the machine. How to execute a command in the SSH'ed machine. > > > > If all you want to do is issue commands, ssh is capable of doing that > > directly, e.g., (from a shell prompt): > > > > $ ssh 10.2.3.4 tail /var/log/syslog > > > > This can be automated by setting up key-based authentication and > > ssh-agent, e.g., using the keychain utility. > > > > IMHO Expect.pm and such are called for when you want to automate > > interactivity with the remote system, i.e., generate output commands > > based on the responses seen. > > > > Ken > > > > -- > > Ken Irving, fn...@ua..., 907-474-6152 > > Water and Environmental Research Center > > Institute of Northern Engineering > > University of Alaska, Fairbanks > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > Expectperl-discuss mailing list > > Exp...@li... > > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > > > > > -- > View this message in context: http://www.nabble.com/query-tf3709123.html#a10390185 > Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |
From: Adrian P. <ad...@ph...> - 2007-05-09 11:43:10
|
>>>>> "Sujai" == sujai <suj...@ta...> writes: Sujai> Hello ken., I want to execute multiple commands on the Sujai> ssh'ed machine.I want to execute iperf server. sujai I have a perl module that I never quite got around to CPANning (wasn't sure how to and never made time to figure it out) eventually named IPC::RemoteSession which allows one to run commands (and eval perl) on a remote connection (assuming ssh keys are setup correctly) :- $conn = IPC::RemoteSession (host => 'ahost'); $output = $conn->cmd ('a shell command'); $output = $conn->cmd ('another shell command'); my $result = $conn->perl ('some perl to eval'); Let me know if you'd like a copy. Sincerely, Adrian Phillips -- Who really wrote the works of William Shakespeare ? http://www.pbs.org/wgbh/pages/frontline/shakespeare/ |