美文网首页
python 获取pid

python 获取pid

作者: Joncc | 来源:发表于2021-02-04 11:19 被阅读0次
def pid():
    """
    获取pid 保存到var/run/task.pid
    """
    pid = os.getpid()
    print(pid)
    with open(file='/var/run/task.pid', mode='w') as f:
        f.writelines(str(pid))

相关文章

网友评论

      本文标题:python 获取pid

      本文链接:https://www.haomeiwen.com/subject/whcbtltx.html