Page MenuHomeDevCentral

Reconcile systemd and pid file management
Open, Needs TriagePublic

Description

Currently:

  • scripts in /opt/odderon/bin rely on /opt/odderon/darkbot.pid
  • systemd unit would be happy to use /opt/odderon/darkbot.pid (defined in the unit as PIDFile) if it was a forking service, but for simple, does it read it?
  • nothing generates /opt/odderon/darkbot.pid

PIDFile=
Takes an absolute file name pointing to the PID file of this daemon. Use of this option is recommended for services where Type= is set to forking. systemd will read the PID of the main process of the daemon after start-up of the service. systemd will not write to the file configured here, although it will remove the file after the service has shut down if it still exists.

We don't need it: for a simple not forking service, systemd knows the pid.

So a convenient (but systemd-vendor-locked) solution could be to replace darkbot restart/kill scripts by sudo systemd alias (see e5ed159bf68a for allowed aliases) and get rid of PIDFile=, ExecReload=.