如何在Ubuntu服务器的后台运行Python程序

前端之家收集整理的这篇文章主要介绍了如何在Ubuntu服务器的后台运行Python程序前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我有一个python脚本.脚本与Chrome一起使用selenium并访问网站,获取数据并输入CSV文件.
这是一项非常漫长的工作.
我把脚本放在服务器上.并运行.一切工作.
但我需要在后台编写脚本.

chmod +x createdb.py
nohup python ./createdb.py &

我明白了

(env)$nohup ./createdb.py &
[1] 32257
(env)$nohup: ignoring input and appending output to 'nohup.out'

按Enter键.

(env)$nohup ./createdb.py &
[1] 32257
(env)$nohup: ignoring input and appending output to 'nohup.out'
[1]+  Exit 1                  nohup ./createdb.py

然后它运行并立即将错误写入文件,Chrome没有启动或没有点击.
我想提醒你,如果你没有nohup开始,那么一切都会奏效.
我究竟做错了什么?如何运行脚本?
非常感谢你.

最佳答案
您可以使用screen命令,它完美地工作.

这是一个非常好的链接https://www.rackaid.com/blog/linux-screen-tutorial-and-how-to/

猜你在找的Python相关文章