pfletch101 wrote: ↑
Sat Jun 20, 2020 7:47 pm
You can give us a lot
more information! The complete unit file would be a good start. However, I would also check that neither the unit file nor the code you are running makes assumptions about where they are running - file references should be absolute.
Okay so I have a daemon I wrote in C and whenever I run it from the CLI it works perfectly, and the daemon forks thus creating the lock PID file. But when I was using the systemd service to launch it the didn't fork and doesn't create the lock PID file. I didn't include a service file because none of them would work. From the very simple to most complex.
I traced the issue to this line in my code
Code: Select all
if(getppid() == 1) return;
i = fork();
Since systemd is PID 1 it would return and not fork and finish setup. So I had to change that line to
It might have been a typo in the example code or just something old that doesn't work anymore, but now the daemon forks and runs properly. So I sorted it out.
Thanks for replying