Jeremie
Jeremie

Reputation: 435

Running python script even if I am not log in

I have an AWS EC2 server, and I was wondering about how to keep a python script running even when I am not logged in on the server. I would like to be able to start a long running script and log out. How can I say to the server 'Ok, I will close my laptop now, but you will keep running the script'?

Upvotes: 0

Views: 632

Answers (1)

Mad Physicist
Mad Physicist

Reputation: 114440

Run your script through the nohup command. The interface is pretty simple. The call would look something like this:

nohup script arg1 arg2

Here script arg1 arg2 are just the usual way you run the script.

When you are able to log back in, stdout and stderr will be in a file called nohup.out. If you want something different, use redirection as described in man nohup.

Upvotes: 1

Related Questions