cleaner.py 文件源码

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

项目:unionfs_cleaner 作者: l3uddz 项目源码 文件源码
def config_monitor():
    old_config = utils.read_file_text('config.json')
    if not len(old_config):
        logger.error("Could not read config.json file... not starting config monitor")
        return

    try:
        mod_time = os.path.getmtime('config.json')
        logger.debug("Started config monitor for config.json")
        while True:
            time.sleep(60)
            if os.path.getmtime('config.json') != mod_time:
                logger.debug("config.json was modified, restarting in 3 seconds...")
                time.sleep(3)
                os.kill(os.getppid(), signal.SIGHUP)

    except Exception as ex:
        logger.exception("Exception occurred: ")


############################################################
# PROCESS STUFF
############################################################
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号