Previous versions of JBoss included a scripts (like jboss_init_redhat.sh
) that could be copied to /etc/init.d in order to add it as a service - so it would star
Here's mine for gentoo. Not perfect yet but pretty clean and working well enough for me. First one small change to the jboss install:
~ # JBOSS_HOME=/opt/jboss # or whatever you have it as
~ # echo "LAUNCH_JBOSS_IN_BACKGROUND=true" >> "${JBOSS_HOME}"/bin/standalone.conf
.
~ # cat /etc/conf.d/jboss
JBOSS_HOME=/opt/jboss
JBOSS_USER=jboss
JBOSS_PIDFILE=/var/run/jboss/jboss.pid
JBOSS_EXECUTABLE="${JBOSS_HOME}"/bin/standalone.sh
JBOSS_STDOUT_LOG=/var/log/jboss/stdout.log
JBOSS_STDERR_LOG=/var/log/jboss/stderr.log
JBOSS_SHUTDOWN_WAIT_SECONDS=60
.
~ # cat /etc/init.d/jboss
#!/sbin/runscript
depend() {
need net
}
start() {
ebegin "Starting JBoss"
start-stop-daemon -S -b -m -p "${JBOSS_PIDFILE}" -u "${JBOSS_USER}" -x "${JBOSS_EXECUTABLE}" -1 "${JBOSS_STDOUT_LOG}" -2 "${JBOSS_STDERR_LOG}"
eend $?
}
stop() {
ebegin "Stopping JBoss"
start-stop-daemon -K -p "${JBOSS_PIDFILE}" -u "${JBOSS_USER}" -R ${JBOSS_SHUTDOWN_WAIT_SECONDS}
eend $?
}
I can't get startup to say [ OK ] as soon as the deployments all finish. I've tried a few things but no luck yet - it either waits forever or currently just says [ OK ] as soon as the shell script is forked. Stopping is better, as long as you set the delay long enough. Log rotation would be pretty easy to add