Serv creates, removes and manages services on multiple init systems (process managers? service managers? can someone come up with a normal name for this? jeez.)
Serv is a Pythonic spinoff of Jordan Sissel's brilliant pleaserun. The question that Serv tries to answer is: "Why the hell do I have to know init systems? I just want this to run forever."
- Abstracts away the platform (systemd, upstart, etc..) - Serv identifies it by itself.
- Creates daemon configuration on different platforms so that you don't have to.
- Allows to run services after generating the config.
- Allows to stop and remove services.
- Provides both an API and CLI for those purposes.
- Provides an API for retrieving service related information.
NOTE: Serv requires sudo permissions! (you can't write to /etc/init.d, /lib/systemd/system and the others without root can ya?)
systemd, Upstart and SysV are mostly supported now.
I intend to add:
- runit
- supervisord
- nssm for Windows.
- Whichever other system that's giving you (or me) a headache.
Note: On Linux, Serv uses ld to identify the distribution.
pip install serv
For dev:
pip install https://github.com/nir0s/serv/archive/master.tar.gz
sudo serv create /usr/bin/python2 --name MySimpleHTTPServer --args '-m SimpleHTTPServer' --var KEY1=VALUE1 --var KEY2=VALUE2 --start -v
sudo serv remove MySimpleHTTPServer
sudo serv status MySimpleHTTPServer
or for all services
sudo serv status
Init system identification is not robust. It relies on some assumptions (and as we all know, assumption is the mother of all fuckups). Some OS distributions have multiple init systems (Ubuntu 14.04 has Upstart, SysV and half (HALF!?) of systemd).
git clone git@github.com:nir0s/serv.git
cd ld
pip install tox
tox
Pull requests are always welcome to deal with specific distributions or just for general merriment.