A long-running app must reload its config without dropping connections. How do you wire this into systemd?
IntermediateScenarioProcesses, services and systemd
Answer
Situation read → Reload instead of restart.
What I'd do →
[Service]
ExecStart=/usr/local/bin/myapp --config /etc/myapp.yml
ExecReload=/bin/kill -HUP $MAINPID
Then systemctl reload myapp. Validate the config first in ExecReload if the app supports it, for example nginx uses nginx -t before the signal.
Why → The app re-reads config on SIGHUP while keeping its sockets open.
Interview tip → systemctl reload-or-restart is handy in automation when you're not sure a unit supports reload.
More on Processes, services and systemd
Your team has a Python API that someone starts with `nohup python app.py &`. Make it a proper service running as a non-root user.BeginnerThe service you created must bind to port 443, but it runs as a non-root user. How?BeginnerYou need to change one setting (memory limit) in a vendor-supplied unit file without editing it. How?BeginnerA service depends on a database on the same host and fails at boot because the DB isn't ready. How do you fix the ordering?IntermediateA service keeps crashing and systemd stops restarting it after a few attempts. How do you tune this?IntermediateA script needs to run once at boot after networking, then exit. How do you do it with systemd?Beginner