[jboss-as7-dev] Linux Service Control for AS

Andrew Lee Rubinger andrew.rubinger at redhat.com
Wed May 18 14:40:35 EDT 2011


This email from Dan Allen yesterday:

---------------

One of the *huge* pains for sys admins assuming control of JBoss AS for
the first time is getting it setup as a system service. We provide this
for our EAP RPMs of course, but we just about annoy the crap out of
system admins and accidental developer admins struggling with
this seemingly simple task.

But no more!

Since one of the main themes of AS 7 is "admin-friendly", then we should
definitely recommend this dead simple recipe for setting up JBoss AS as
an upstart service. The Torquebox guys show how to do this with AS 6
(which is part of the Torquebox distribution).

http://torquebox.org/news/2011/05/11/simplify-your-deployment/

which was inspired by the original article by Heroku

http://adam.heroku.com/past/2011/5/9/applying_the_unix_process_model_to_web_apps/

The recipe involves running foreman on a Procfile. foreman is a ruby
gem. But actually, foreman is really just a means to an end. In the end,
you are just creating three files in /etc/init that look like this:

*/etc/init/jboss-as.conf*
pre-start script

bash << "EOF"
   mkdir -p /var/log/jboss-as
   chown -R dallen /var/log/jboss-as
EOF

end script

*/etc/init/jboss-as-default-1.conf*
start on starting jboss-as-default
stop on stopping jboss-as-default
respawn

chdir /home/dallen/opt/jboss-as
exec su dallen -c 'export PORT=5000; ./bin/run.sh >>
/var/log/jboss-as/default-1.log 2>&1'

*/etc/init/jboss-as-default.conf*
start on starting jboss-as
stop on stopping jboss-as

The it's just:

start jboss-as

and

stop jboss-as

Ahhhhhh.

We should definitely include this in the AS documentation (both for AS 6
and AS 7). You can't imagine how many hours this is going to save admins.


More information about the jboss-as7-dev mailing list