services on linux

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Tue Sep 20 06:41:19 EDT 2005


Christoph Haas wrote:
> On Tue, Sep 20, 2005 at 02:57:26AM -0500, pt python wrote:
> 
>>im moving from the windows world to the linux world and i need to make
>>a python script to see if a service is instaled (ex: apache), if it is
>>running or stoped and to start/stop a service like apache or mysql.
>>Theres an API on windows to manage services and i need to know how to
>>do that on linux. Can anyone help me with the module and API to work
>>with services on linux?
> 
> 
> Unless you really want to do that in Python. It's just a matter of "ps"
> and "grep". Simple shell stuff.
> 
> Example: ps ax | grep apache
> 


On RedHat based distro's (fedora in my case)


/sbin/service sshd status


gives me (as a normal user) the status of my ssh server not sure if 
other distro's have this...



> 
>>by the way, im developing a app, maybe multi-plataform, to install and
>>manage several open source packages like apache, mySQL, phpwebadmin,
>>phpnuke, etc... if anyone have nice ideais i apreciate that..
> 
> 
> That's usually the Linux distribution's job to handle the installed
> packages. Some distributions do that better than others
> (<cough>Debian<cough>). ;) Or what did you mean when you said "install
> and manage"?
> 


yeah you really need to look at the tools you have been given with your 
distro, rpm, deb, etc for the best way.  If it's pure python then the 
distutils package (in the python standard library) may help, also I 
noticed that PyInstaller 1.0 has just been released

http://pyinstaller.hpcf.upr.edu/pyinstaller


and has options to create single file installers for Linux / IRIX and 
Windows...










More information about the Python-list mailing list