I’ve created a small Go binary that I want to have a systemd service for.
Running the binary manually works, but when I try to use systemctl to start it, it will do it’s inital non-workpool setup but then timeout: holdoff time over, scheduling restart. Before that happens I would have expected the first workers to be done with the first job, but I also never see their output
I then tested the same script with a Hello World webserver binary and that works, leaving me the fact that goinggo/workpool is probably involved.
I’m not really familiar with systemd, however I did try to set its Type to forking as well, but that didn’t work.
So my questions is; Does anyone have experience with systemd (or similiar) and the workpool package (or goroutines in general) and managed to get systemd to not timeout with goroutines
If the program crashed there should be information in stderr which systemd will have squirreled away in its journal. That’s the extent of my knowledge with systemd. If you can find and post the complete crash report, maybe we can figure it out.
The Stdin reader bit was part of the WorkPool example, to stop the program from exiting while its queues are still full.
My system knowledge is not that great, but I understand that it’s not really a proper exit code. But then again it is also not supposed to be, but more run as a daemon.
Why does the application need to signal systemd to do anything ? Can you use a mode where systemd just checks that the child process is running, ie has not exited yet.
I don’t know what reading from stdin is going to do for you, stdin is connected to /dev/null by default when running under an init system (not just systemd) so ReadString will immediately return io.EOF, but you’re not checking the error.
My guess is your main function returns instantly, and when main returns, the program will exit.