[英]How to let the python script (abc.py) keep executing on AWS even after Connection lost or SSH connection is terminated?
I was using Jupyter notebook
on AWS AMI and using the port forwarding on Windows using PuTTY
.我在 AWS AMI 上使用
Jupyter notebook
,并使用PuTTY
在 Windows 上使用端口转发。 I got my connection terminated and all the work of 24 hours is lost now and I'm unable to get that.我的连接被终止了,现在 24 小时的所有工作都丢失了,我无法得到它。 So I used a script instead of Notebook and the same thing happened.
所以我使用了一个脚本而不是笔记本,同样的事情发生了。 I used to think that the process would keep going on even if the Shell connection is lost.
我曾经认为即使Shell连接丢失,该过程也会继续进行。 But next time I login, I don't see anything.
但是下次我登录时,我什么也看不到。 I used
top
, htop
aux
to find if my processes are still running but they don't show my process.我使用
top
和htop
aux
来查找我的进程是否仍在运行,但它们没有显示我的进程。 Please help how can I stop this from happening.请帮助我如何阻止这种情况发生。
I am using Windows on 10 with Putty
on local and Ubuntu 18
on the AWS AMI.我在 10 上使用 Windows,在本地使用
Putty
,在 AWS AMI 上使用Ubuntu 18
。
You can try你可以试试
nohup python3 myscript.py &
Try the tmux试试 tmux
apt install tmux
I often use it to keep my web runing on server(not professional but convenient)我经常用它来保持我的web在服务器上运行(不专业但方便)
You can use screen.你可以使用屏幕。
You can install it wit:你可以安装它:
sudo apt install screen
You can find more information right here: https://linuxize.com/post/how-to-use-linux-screen/您可以在这里找到更多信息: https://linuxize.com/post/how-to-use-linux-screen/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.