battery icon indicating copy to clipboard operation
battery copied to clipboard

Fix pidfile is not updated when daemon is started

Open rguca opened this issue 1 year ago • 2 comments

When the daemon is started at system startup, the pidfile is not updated. This leads to problems when you change the maintenance level because the old daemon is not killed and a new one is started.

rguca avatar Jan 16 '25 14:01 rguca

Hey @rguca!

Under what circumstances are you encountering issues?

The daemon is already culled in the maintain scripts, and the background processed are stored and stopped (you are storing $$ in your PR instead of $!). The $$ process is stopped once the commands complete.

actuallymentor avatar Jul 04 '25 13:07 actuallymentor

Hey @rguca!

Under what circumstances are you encountering issues?

The daemon is already culled in the maintain scripts, and the background processed are stored and stopped (you are storing $$ in your PR instead of $!). The $$ process is stopped once the commands complete.

Currently deamon pid is stored with $! from maintain function at command execution. At system startup, the function maintain_synchronous is called (defined in plist), which then doesn't write the pidfile. Because the pidfile is not written, the daeman can't be killed by its pid later. $$ is used in the PR in maintain_synchronous, which is called by the daemon itself, so the pidfile is always written.

rguca avatar Jul 04 '25 17:07 rguca