Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kasun/YapDi
Yet another python Daemon implementation
https://github.com/kasun/YapDi
Last synced: 13 days ago
JSON representation
Yet another python Daemon implementation
- Host: GitHub
- URL: https://github.com/kasun/YapDi
- Owner: kasun
- License: isc
- Created: 2011-11-19T17:41:29.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-06-03T18:52:17.000Z (over 11 years ago)
- Last Synced: 2024-08-01T22:56:25.275Z (3 months ago)
- Language: Python
- Homepage:
- Size: 157 KB
- Stars: 83
- Watchers: 6
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YapDi - Yet another python Daemon implementation #
## Overview ##
As the name implies YapDi is yet another python daemon implementation. Python 2.x standard library didn't have a daemonizing module. It is one of those rare few modules python standard library lacked that put the phrase "batteries included" to shame. There is [PEP 3143](http://www.python.org/dev/peps/pep-3143/) which introduces a daemonizing package to python 3.x standard library.
Python community is scattered with so many daemon implementations and this is one of them. This module is a modified version of a code originally posted [here](http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/). So any compliments should go there first.
## Installation ##
python setup.py install
## Basic Usage ##
import yapdi# Creating a yapdi daemon instance
daemon = yapdi.Daemon()# You can also supply a pid file name at daemon instance creation time
daemon = yapdi.Daemon(pidfile='/var/run/.myservice.pid')
# Daemonizing an instance; Any code placed under this would get executed in daemon mode
daemon.daemonize()# Stopping a running instance
daemon.kill()# Restarting an instance; If an instance is already running it would be killed and started again, else would just start
daemon.restart()# Checking whether an instance is running
if daemon.status():
print('An instance is already running')
else:
print('No instance is running')# Running a daemonized instance as a different user; any code below these two lines would get executed in daemon mode as user 'user123'
daemon.set_user('user123')
daemon.daemonize()