Calling an application from inside a python script Take 1

Chris Watson scanner at jurai.net
Thu Jan 4 01:57:34 EST 2001


Hi everyone,

I *just* started getting into learning python.
I am currently working on a menu'ing system to keep non admin people from
goofing things up on some FreeBSD servers in a datacenter. I have very
little BG in coding. My menu system has a section for allowing the admins
to edit the various config files for different servers. For instance the
first python script which I am doing prompts the user for a hostname of
the server that apache is running on. It will save that hostname in the
variable host.

host = raw_input("Enter a hostname: ");

Then I want to pass the $host variable to ssh. So it does something like
this:

ssh -l root $host vi /usr/local/etc/apache.conf

Which will allow the tech to edit the web servers config file. But he
wont need to know ssh, or or anything else. My long winded question is
how do I get python to call an external application?

If someone could point me in the right direction I would really
appreciate it. Thanks for your time!

Chris



More information about the Python-list mailing list