Interview Prep/Linux/Processes, services and systemd

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.

All Linux questions Roadmap: Linux

More on Processes, services and systemd