Update: remote Linux management via Python and ssh
I installed paramiko and tested out ssh.py (see the Edit on my last post). Python isn't just easy to use, it's *incredibly* easy to use...and now it's even more powerful and easy to use than before (is that possible?!?).
The problem with my last post is that you have to manually manage timing. It's a serious pain (Edit - relatively speaking, of course)...you "stdin.write("""<some long-running command>""")", and then you have to time.sleep() or manually check if <some long-running command> is still running. Blech...forget that.
Enter ssh.py. Here it is, in a nutshell:
Wow, that's simple...to the author of ssh.py: My hat's off to you.
Again, you'd want to add "production-quality" error handling, but that's the core of it. I'm currently updating my management scripts to use ssh.py heh
Edit - there is a continuation post here that continues where this post left off.
The problem with my last post is that you have to manually manage timing. It's a serious pain (Edit - relatively speaking, of course)...you "stdin.write("""<some long-running command>""")", and then you have to time.sleep() or manually check if <some long-running command> is still running. Blech...forget that.
Enter ssh.py. Here it is, in a nutshell:
Code:
import ssh
s = ssh.Connection("remotehost")
results = s.execute(<some long-running command>)
s.close()
for line in results: print line
Again, you'd want to add "production-quality" error handling, but that's the core of it. I'm currently updating my management scripts to use ssh.py heh
Edit - there is a continuation post here that continues where this post left off.
Total Comments 0









