Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/torfsen/service
Easy implementation of Unix background services in Python
https://github.com/torfsen/service
Last synced: 27 days ago
JSON representation
Easy implementation of Unix background services in Python
- Host: GitHub
- URL: https://github.com/torfsen/service
- Owner: torfsen
- License: mit
- Created: 2015-01-09T14:13:20.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T05:02:27.000Z (about 2 years ago)
- Last Synced: 2024-11-09T01:59:29.288Z (about 1 month ago)
- Language: Python
- Homepage: http://python-service.readthedocs.org
- Size: 94.7 KB
- Stars: 58
- Watchers: 8
- Forks: 14
- Open Issues: 10
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- starred-awesome - service - Easy implementation of Unix background services in Python (Python)
README
Python background services made easy
####################################.. image:: https://travis-ci.org/torfsen/service.svg?branch=master
:target: https://travis-ci.org/torfsen/serviceThe Python ``service`` package makes it easy to write Unix *services*, i.e.
background processes ("daemons") that are controlled by a foreground
application (e.g. a console script)::from service import Service
class MyService(Service):
def run(self):
while True:
do_work()if __name__ == '__main__':
import sysif len(sys.argv) != 2:
sys.exit('Syntax: %s COMMAND' % sys.argv[0])cmd = sys.argv[1].lower()
service = MyService('my_service', pid_dir='/tmp')if cmd == 'start':
service.start()
elif cmd == 'stop':
service.stop()
elif cmd == 'status':
if service.is_running():
print "Service is running."
else:
print "Service is not running."
else:
sys.exit('Unknown command "%s".' % cmd)For details, please see the documentation_.
.. _documentation: http://python-service.readthedocs.org/
Installation
============
Installation is easy via pip_::pip install service
.. _pip: https://pip.pypa.io/en/latest/index.html