I have a daemon in /opt/xyz/bin/xyz. Unfortunately it cannot fork itself into background and will not be able to do so within the next half year. My problem is the following: Entering
service xyz start
just returns
xyz start/running, process 23484
Always, even when it immediately exits with exit code 1. My config is this:
$ cat /etc/init/xyz.conf
description "XYZ"
start on started networking
stop on shutdown
exec /opt/xyz/bin/xyz
The rest works fine. Upstart recognizes when the process is already started, stopping works fine too.
Any suggestions?
You need a post-start stanza which will query the service as to whether or not it is providing whatever service it is expected to be running. So something like
When adding the ability to daemonize your service, if at all possible, make sure that it does not fork until it is ready to handle requests, then 'expect fork' will delay the 'started' condition properly, otherwise you will still need this post-start.