1

So I am running a very normal server written in python, here's how I start up my server

python main.py 2>&1 &

The process will simply get shutdown after some 20000 seconds after my linux session goes time out. How can I prevent that?

Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74
Louis Ng
  • 13
  • 2
  • Using `nohup` as answered is an easy way, but for a more permanent solution you might want to look into setting up e.g. a systemd service for your application, so systemd will ensure it remains running at all times. – AKX Aug 04 '21 at 07:12

1 Answers1

0

You have to start the process in detached mode by:

nohup python main.py 2>&1 1>/dev/null &
Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74