daemon.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:spoon 作者: SpamExperts 项目源码 文件源码
def send_action(action, pidfile, logger=None):
    """Send a signal to an existing running daemon."""
    if logger is None:
        logger = logging
    if not os.path.exists(pidfile):
        logger.critical("No pid file available: %s", pidfile)
        return
    with open(pidfile) as pidf:
        pid = int(pidf.read())

    if action == "reload":
        os.kill(pid, signal.SIGUSR1)
    elif action == "stop":
        os.kill(pid, signal.SIGTERM)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号