项目作者: ericsuh

项目描述 :
Python package for UNIX/Linux daemon boilerplate
高级语言: Python
项目地址: git://github.com/ericsuh/daemonic.git
创建时间: 2013-01-02T23:10:21Z
项目社区:https://github.com/ericsuh/daemonic

开源协议:

下载


Daemonic

Context manager to eliminate daemonizing boilerplate code.

Installation

Install with pip install daemonic.

Use

Daemonic is pretty easy to use as a context manager:

  1. with daemonic.daemon(
  2. pidfile='/var/run/mydaemon.pid',
  3. stdout=open('/var/log/mydaemon.log', 'a')):
  4. # your daemon code here

daemonic takes care of:

  • Forking twice to detach from the current terminal/process
  • Changing to a different working directory
  • Managing user file creation permissions (umask)
  • Redirecting standard input/output/error
  • Creating a locked PID file

License

MIT license.