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.

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

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.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.