这是一个Python类,它将重新编译Python脚本,以便它可以继续在后台运行。

DaemonLite的Python项目详细描述



名称

DaemonLite is a library for writing system daemons in Python. It is distributed under MIT license.

Based on https://github.com/serverdensity/python-daemon


概要

from DaemonLite import DaemonLite

class Staff(DaemonLite) :
    def run(self) :
        # Do something

staff = Staff('/var/staff/staff.pid')
staff.start()

操作

start() - starts the daemon (creates PID and daemonizes). stop() - stops the daemon (stops the child process and removes the PID). restart() - does stop() then start().

前景

This is useful for debugging because you can start the code without making it a daemon. The running script then depends on the open shell like any normal Python script.

To do this, just call the run() method directly.

staff.run()

说明

This is a Python class that will daemonize your Python script so it can continue running in the background. It works on Unix, Linux and OS X, creates a PID file and has standard commands (start, stop, restart) + a foreground mode.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java爬虫获取外部网站搜索结果   java Bluestack未连接到eclipse   java如何从ConstraintViolationException Hibernamte获取数据库字段名   HttpResponse HttpResponse=httpClient引发java运行时错误。执行(httpPost);   Jama中矩阵的java点积和叉积   java有什么方法可以唯一地识别可扩展设备吗?   java我需要用*来写我的名字,但我不断遇到一个错误,我对编码很陌生   java变量是在内部类中访问的。需要被宣布为最终决定。但我不想宣布最终结果   java如何缩短base64图像字符串,Android?   JavaSpringMVC:计划方法不自动触发   图形学习Java 2D API的好资源是什么?   如何在java中对方法进行排队   java JavaFX多行   java Selenium无法在[链接]上找到基于CSS元素的密码字段元素http://www.cartasi.it/gtwpages/index.jsp   Java中的equals()和hashCode()契约   软删除情况下的java Hibernate二级缓存   java为什么这段代码要两次调用这些方法?