Running python in command line without keeping the EC2 instance connect session open

0

I recently took an image for Ubuntu Linux server and it provided me access to command line via EC2 instance connect. I was able to start the python program that i wrote and it runs normally as expected. I want this to run without any interruption 24 X 7. The program is designed to run continuously.

When i close the browser session and reconnect again via EC2 instance connect, i do not see the python program running when i checked the ps aux command. I thought of running the python program as service but i am not able to do it due to restrictions with the permission in /var/run/.

Please provide the best option to address this.

已提問 6 個月前檢視次數 201 次
1 個回答
1
已接受的答案

Linux's screen command is what you want. It allows you to run something in a shell, then you can detach from that session and it keeps running in the background.

Then to check its progress you reattach to the screen session, and can detach from that again later. And so on.

https://linuxize.com/post/how-to-use-linux-screen/

profile picture
專家
Steve_M
已回答 6 個月前
profile picture
專家
已審閱 6 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南