# omq - GlassFish OpenMQ server
#
description     "GlassFish <%= @resource.instance %> OpenMQ server"

start on filesystem or runlevel [2345]
stop on runlevel [!2345]

<% omq_home = "#{node[:glassfish][:base_dir]}/mq" %>
<% authbind_prefix = @authbind ? "/usr/bin/authbind --deep " : "" %>

pre-start script
    test -x <%= omq_home %>/bin/imqbrokerd || { stop; exit 0; }
end script

exec start-stop-daemon --start -u <%= node[:glassfish][:user] %> --exec <%= authbind_prefix %><%= omq_home %>/bin/imqbrokerd -vmargs "<%= @vmargs %>" -varhome <%= @resource.var_home %> -port <%= @resource.port %> -javahome <%= node["java"]["java_home"] %> -name "<%= @resource.instance %>"

# omq - GlassFish OpenMQ server
#
description     "GlassFish <%= @resource.instance %> OpenMQ server"

start on filesystem or runlevel [2345]
stop on runlevel [!2345]

<% omq_home = "#{node[:glassfish][:base_dir]}/mq" %>
<% authbind_prefix = @authbind ? "/usr/bin/authbind --deep " : "" %>

pre-start script
    test -x <%= omq_home %>/bin/imqbrokerd || { stop; exit 0; }
end script

exec su <%= node[:glassfish][:user] %> -c '<%= authbind_prefix %><%= omq_home %>/bin/imqbrokerd -vmargs "<%= @vmargs %>" -varhome <%= @resource.var_home %> -port <%= @resource.port %> -javahome <%= node["java"]["java_home"] %> -name "<%= @resource.instance %>"'

Return to using su to lauch service as a user as start-stop-daemon was not working as expected
Return to using su to lauch service as a user as start-stop-daemon was not working as expected
