Process id dismiss when ssh connect again

In order to execute a task background, I use nohup command.

 # nohup python &

Everything works well but when I close ssh connection and connect it again, I find the process id does not exist.The python task sends a request to an api every 20 minutes.From the api server console, I find the process still works.However from ps command I can not find the process id


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

It’s possible that the program has crashed. I would recommend using screen instead of nohup. You can install it by running

sudo apt-get install screen

Then, you can start a session by running screen. This will launch a new bash process that you can run python in. First, enable logging in order to identify the issue by pressing Ctrl-a, H. Run your program, and press Ctrl-a, d to detach from the session, which will keep it running in the background. You can now disconnect from your Droplet and the screen session will keep running. Keep an eye on the log file and see if it has any information if the process quits again.