计算之道

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

问题:一个python脚本test.py,内含while True循环。想让这个while True循环永远在后台运行。

如果在终端直接 python test1.py &  ,脚本正常运行,但是此时关闭ssh终端,脚本将会推出。

解决:

1、通过 nohup ./proc_source.py  > nohup.log 2>&1 &  运行脚本。(推荐)

2、通过编写shell启动脚本运行python脚本

#! /bin/sh
python test123.py &

然后运行shell脚本即可。

posted on 2019-10-28 17:04  计算之道  阅读(6450)  评论(0编辑  收藏  举报