The su should not use '-' here since that will make the shell that su starts a login shell, which pulls in way too much environment for a humble daemon. 'su "${JBOSS_USER}" -c "$0 run" &' should be all that's needed here.