43 Star 236 Fork 58

xupingmao / xnote

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
sentinel.py 644 Bytes
一键复制 编辑 原始数据 按行查看 历史
xupingmao 提交于 2022-05-08 10:39 . Add 开发者功能
# encoding=utf-8
"""哨兵进程
错误码说明
错误码 | 说明
------| -------
0 | 正常退出
1 | 异常退出,一般是程序错误
https://blog.csdn.net/halfclear/article/details/72783900
"""
import sys
import os
def main():
args = sys.argv[1:]
args.insert(0, sys.executable)
cmd = " ".join(args)
print("Command", cmd)
while True:
# exit_code = subprocess.call(args, shell = True)
exit_code = os.system(cmd)
print("exit_code:", exit_code)
# Mac返回 52480
if exit_code in (205, 52480):
print("restart ...")
print("-" * 50)
print("-" * 50)
else:
return
if __name__ == '__main__':
main()
Python
1
https://gitee.com/xupingmao/xnote.git
git@gitee.com:xupingmao/xnote.git
xupingmao
xnote
xnote
master

搜索帮助