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.

asked 5 months ago188 views
1 Answer
1
Accepted Answer

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
EXPERT
Steve_M
answered 5 months ago
profile picture
EXPERT
reviewed 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions