我正在通过 ssh 在 python 上运行 python 脚本 sample_program.py
。我登录到机器,然后运行
python3 sample_program.py &
然后使用命令“exit”注销。不幸的是,脚本在几分钟后停止运行。
我还可以使用什么来远程运行 python 脚本而不保持终端打开?
最佳答案
不存在
nohup python3 sample_program.py &
是最简单的方式(man nohup
):
nohup - run a command immune to hangups, with output to a non-tty
恕我直言,它无处不在。
关于python - 通过 ssh 可以替代 "python3 sample_program.py &"的方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36510091/