“python3 sample_program.py &"的替代品是什么?通过ssh? [英] What are the alternatives to "python3 sample_program.py &" via ssh?

查看:47
本文介绍了“python3 sample_program.py &"的替代品是什么?通过ssh?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 ssh 在 python 上运行 python 脚本 sample_program.py.我登录机器,然后运行

I am running a python script sample_program.py on python via ssh. I log into the machine, and run

python3 sample_program.py &

并使用退出"命令注销.不幸的是,脚本在几分钟后停止运行.

and log off with the command 'exit'. Unfortunately, the script stops running after a few minutes.

我还能用什么来远程运行 python 脚本而不让终端保持打开状态?

What else could I use to run python scripts remotely and not keep the Terminal open?

推荐答案

nohup

nohup python3 sample_program.py &

是最简单的方式(man nohup):

nohup - 运行一个不受挂断影响的命令,输出到非 tty

nohup - run a command immune to hangups, with output to a non-tty

恕我直言,它无处不在.

and IMHO it is installed everywhere.

这篇关于“python3 sample_program.py &"的替代品是什么?通过ssh?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆