Chapter 7. Install JBoss as daemon and Startup Service on Linux
This section (provided by Seah Hong Yee) is devoted to the automatic start up of jboss services during the startup phase of a server. It also simplifies manual jboss startup with the use a of System V init script. The following configuration has been tested on Mandrake Linux 10.1 and SuSe Linux Enterprise Server 9. Based on the particular distribution at hand there might be some minor differences in init scripts and configuration, but the following guide should work with RHEL, CentOS, WhiteBox and Fedora.
In the directory $JBOSS_HOME/bin there should be two init scripts:
jboss_init_redhat.sh
jboss_init_suse.sh
If you are using Mandrake/Mandriva, RHEL, CentOS, WhiteBox or Fedora:
Copy the jboss_init_redhat.sh script into /etc/init.d and rename it to jboss.
Edit the script and adapt the following parameters: JBOSS_HOME and JAVAPTH
Although not strictly necessary, you might want to include an entry like:
Example 7-1. Declare location of jdk
export PATH=/usr/java/j2sdk1.4.2_08/bin
(/usr/java/j2sdk1.4.2_08/ being your jdk path, adapt it to your environment)
At the top of the script there's an entry that resembles the following one:
Example 7-2. Declare startup sequence
# chkconfig: 3 87 20
The second set of digits represents the order sequence of the service startup. Make sure the number is larger than your database startup. Typically postgresql starts with the sequence number of 85, so I have my jboss startup with the sequence of 87
Type the commands
Example 7-3. Add jboss to config
# chkconfig --add jboss
# chkconfig jboss on
From now on jboss should startup automatically after reboot, or you can do it manually with service jboss restart.
For Suse Linux, please do the following :
Copy the jboss_init_suse.sh script into /etc/init.d and rename it to jboss.
Edit the script and change the following parameters: JBOSS_HOME and JAVAPTH
Although not strictly necessary, you might want to include an entry near the top of the script:
Example 7-4. Declare location of jdk
export PATH=/usr/java/j2sdk1.4.2_08/bin
(/usr/java/j2sdk1.4.2_08/ being your jdk path, adapt it to your environment)
Type the command "inserv jboss"
Go into directory /usr/sbin and create a symbolic link with "ln -s /etc/init.d/jboss rcjboss"
Execute the command "chkconfig jboss on"
You should be able to start jboss with the command "rcjboss start"