Linux service is not started by when run by Chef but starts fine when run manually

Hi all,

I’ve created a service to be started on node boot. I’m using CentOs 6.7 and if I start my service manually via service start it starts fine.

However when running via Chef the service is not started but I see the command to start it was run as there are some echo messages that I can see on Chef logs.

My start script has to change the user and to daemonize itself. This is the script I’m using but I’ve also tried su and sudo.

start() {
ulimit -n 65535
[ -x startExec ] || exit 5 echo -n "Starting $prog: . Command $startExec. User: <%=node[:wls][:user][:name]%>"
daemon --user <%=node[:wls][:user][:name]%> "startExec" retval=?
echo -n $"RETVAL = $retval"
return $retval

Any ideas?


There was a similar (although not answered) discussion here:

If you're using an older version of the varnish cookbook I know a buggy
monkey patch caused service detection failure to break