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.

posta 6 mesi fa201 visualizzazioni
1 Risposta
1
Risposta accettata

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
ESPERTO
Steve_M
con risposta 6 mesi fa
profile picture
ESPERTO
verificato 6 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande