How Do I Prevent the nohup Background Process from Being Killed After a VNC Session Ends?
Symptom
The nohup background process started in a VNC session is automatically killed by the system after the VNC session ends (for example, after you run exit to log out or a login times out).
Possible Cause
For security purposes, the upstream community modified the getty service and deleted KillMode=process. As a result, all processes are killed after the VNC login session ends. For details, see https://github.com/systemd/systemd/commit/021acbc188a53fa528161578305406c5c9c808b2.
Solution
You can modify the getty settings to retain the nohup background process.
- Run vim /usr/lib/systemd/system/getty\@.service to modify the getty service unit.
- Add KillMode=process to the [Service] section, and save the file.
- Run systemctl daemon-reload to reload services.
- Run systemctl restart getty@`basename $(tty)` to restart the getty service.
Restarting the getty service will exit the current session.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot