I have a pubsub python script. When I run the receiver script and send to the background using nohup and &, and close the ssh session, the process is killed.

Is there any way to run receiver all the time?


Welcome to U&L.

This might be of help: Why does my Python background process end when SSH session is terminated?

BTW: starting a process in the shell and counting on it to stay available is not the recommended way to go. Have you considered writing a custom systemd service unit file to accomodate background service behaviour?

A quick search gives for example: https://tecadmin.net/setup-autorun-python-script-using-systemd/

For a manual: https://www.freedesktop.org/software/systemd/man/systemd.service.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.