-1

I need help to start my Python application on DigitalOcean droplet. I set up all the settings and now can run my python file. But if I close the Ubuntu console - my loop or any other code (sending requests for example) finish. I want to start a Flask server which will receive webhooks all time when machine works (24/7). How can I start the process without working console on my Desktop? The question is not about Flask, only about endless working program. Thanks.

1 Answers1

0

You could use screen or nohup to have your python script running 24/7.

screen allows you to create a terminal session and detach from it, leaving the process started on it running. You can install it on Ubuntu with the command below. See this tutorial or this one for more information.

sudo apt-get update sudo apt-get install screen

nohup allows you to do the same. It basically runs a command ignoring hangup signals, not stopping when you log out. Unlike screen, nohup is normally already installed by default on Ubuntu. See its manual page for more information about it.

Finally, in case you are interested in knowing more about the differences between screenand nohup, they were explained in this post.

Albert Rial
  • 106
  • 7