官方案例:
import daemon from spam import do_main_program with daemon.DaemonContext(): do_main_program()
一般实用案例:
import daemon if __name__ == '__main__': print 'start' out = open(LOG_FILE, 'a') with daemon.DaemonContext(pidfile=FileLock('/var/run/xxx.pid'), stdout=out, stderr=out): main() >> 运行: python xxx.py
下一篇:《svn配置》