After some digging, it seems that the issue is related to the fact that I'm
backgrounding the process, which seems odd as should only use
service-command to start/stop the process(?)
The start function in the init-script looks like this:
daemon "/path/to/app/appname $OPTS >/dev/null 2>&1 &"
Having seen this before I suspect it's still not daemonizing correctly.
Some of us were talking about an issue similar to this on IRC the
other day regarding the RabbitMQ and JBossAS init scripts. The
solution we came up with was:
That would nohup the entire /sbin/service process which is most likely not preferable and could most likely lead to complications if unlucky.
I will stick with daemonize as it’s designed to deal with applications that can’t do this themselves as also seems to be available in most distributions (http://software.clapper.org/daemonize/).
I simply added “/usr/sbin/daemonize -u app_user /path/to/app/appname $OPTS” to my custom init-script to solve the problem.