0

Created an executable and planned to use it as service.

When running it on Ubuntu 12.04 or 14.04 using upstart, it works fine.

However, on Ubuntu 15.04 (with systemd), this command won't not terminate:

systemctl start mySrv01

Could it be because I didn't close stdin? upstart doesn't seem to mind. Any ideas? Thanks.

packetie
  • 135
  • 9

2 Answers2

1

Didn't have to do this when using upstart, don't know why.

You don't have to do it with systemd, either. You have a readiness protocol mismatch. Your service unit file says that your program employs the Type=forking readiness protocol. But your program itself actually did not.

The forking readiness protocol is hard to get right, and easy to get wrong. Almost no program in the wild actually employs it. Just make your service unit Type=simple if that's what it already was to start with.

Moreover, you don't need to muck around trying to "dæmonize" by doing things like closing open file descriptors. Your program is already dæmonized.

Further reading

JdeBP
  • 3,959
0

Turned out for systemd, the daemon process mySrv01 will have to fork a child process and better off, close stdin.

Didn't have to do this when using upstart, don't know why.

packetie
  • 135
  • 9