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 start on boot up. I can't seem to find any similar scripts in JBoss 7. Has anyone already done something like this?
P.S. I'm trying to achieve this in Ubuntu 10.04
The answer marked as correct here did not work for me. On restart, you get a security error related to the usage of sudo, stating, "sorry, you must have a tty to run sudo." Further research revealed that disabling the sudo tty restriction could cause plain text exposure of passwords, so that's no good.
Here's what I ended up with and it works fine for me:
Recently I wrote installer for JBoss AS 7 that downloads tar.gz file from RedHat's server, extract it, add jboss-as as service and makes some very basic configuration. With it I get ready for use JBoss AS 7 in several seconds.
Installation script:
Init script:
I described the script steps in my blog post. It also has the link to download this script files as archive.
After spending a couple of hours of snooping around I ended up creating
/etc/init.d/jboss
with the following contentsHere's the content of
java.sh
:And
jboss.sh
:Obviously, you need to make sure, you set JAVA_HOME and JBOSS_HOME appropriate to your environment.
then I ran
sudo update-rc.d jboss defaults
so that JBoss automatically starts on system bootI found this article to be helpful in creating the start-up script above. Again, the script above is for Ubuntu (version 10.04 in my case), so using it in Fedora/RedHat or CentOS will probably not work (the setup done in the comments is different for those).
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:
.
.
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
Another way to run JBoss as a service on linux:
JBoss as service in linux
There is a directory in the jboss distribution located in bin/init.d with a shell script you can place in init.d to launch jboss as a service. The script is called jboss-as-standalone.sh