Reputation: 53
I have a code.py
script that I want to run on my Linux EC2 instance. I want it to run even when the tab of the EC2 instance in my browser is closed, so that the code is running in the background.
Is there any way to do this?
Upvotes: 2
Views: 1926
Reputation: 620
this command run your python file on another screen that called YourScreenName
.
screen -dmS YourScreenName python3 code.py
if you close EC2 instance tab on your browser, this screen will be running on your server.
for access to this screen you can use this command.
screen -r YourScreenName
and for quit from this screen use Ctrl + a + d
Upvotes: 5