On Tue, 2003-02-11 at 17:28, David Simmons wrote:
> We have a couple of servers that we want to push out periodic updates
> to.  We want to automate this as much as possible.  
> 
> We have password-less ssh working (thanks to the group for that!).  So
> using a shell script we can login in to a remote machine.  But that is
> all we can do.  Once we login we are in a completely different shell
> environment.  My script stops executing at that point.  Once I logout of
> the remote server, my script continues running.
> 
> Is it possible to continue feeding commands from the ssh shell script I
> wrote to the remote machine?  For example, if my script is something
> like:
> 
> ssh [EMAIL PROTECTED]
> cd /usr/local
> echo "some new command" >> therefile
> logout
> exit 1
> 
> How can I get everything past the ssh command to run on the remote
> machine?  Is it possible?


I did this in Python, but not shell.

Use Popen3; you can open a connection, it will return three file
handles, stdin, stdout, and stderr. You can then write and read commands
to these. I did this on a network with HP-UX and Linux clients. It
worked perfectly.

If interested, I can post my script example for it. It is one of the
things I use in my sysadmin w/Python class. :)

In shell, you wind up needing to do it the way you do with rcp: sending
each command in it's own connection. Or use expect. :(


-- 
Bill Anderson
RHCE #807302597505773
[EMAIL PROTECTED]





-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to