[j-nsp] Running shell commands from ssh.

a.dhingra at neu.edu a.dhingra at neu.edu
Fri Mar 17 11:54:18 EST 2006

You can also use rancid.  That works pretty well...



"Vladimir S. Blazhkun" <v.blazhkun at pcs-net.net> 
Sent by: juniper-nsp-bounces at puck.nether.net
03/17/2006 06:46 AM

Warren Kumari <warren at kumari.net>
jnsp list <juniper-nsp at puck.nether.net>
Re: [j-nsp] Running shell commands from ssh.

> Hi y'all,
> I seem to remember having seen a way to do this, but cannot find it
> anymore (checked the list, Juniper-clue, etc) -- I need to run some
> shell commands from a non-interactive ssh.
> I have tried various permutations of ssh <router> "start shell; ls;
> exit; exit" and similar things, but no luck. It seem that the
> commands that are passed in do not get handed to the shell....
> And no, I don;t want to create another user (or change an existing
> user) to have a shell of something other than "/usr/sbin/cli"
> Warren.

Write a simple script using expect/tcl/tk for this.

#!/usr/bin/expect --
set ssh "/usr/bin/ssh"
set timeout 30
spawn $ssh <router>
sleep 5
send "start shell\n"

and so on...

Vladimir S. Blazhkun,               Personal Communications Systems, LLC.
Leading IP NCC Specialist,          Work phone: +7 495 7847617 ext. 1101.
            JNCIA-J  JNCIA-M #773  JNCIS-M #1100  JNCIP-M #289
juniper-nsp mailing list juniper-nsp at puck.nether.net

More information about the juniper-nsp mailing list