13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

20.5 Things That Make It Go463Example 20.5 Using chkc<strong>on</strong>fig to include JBoss start script[root@cvs root]# cd /usr/local/jboss/bin[root@cvs bin]# cp jboss_init_redhat.sh /etc/init.d/jboss[root@cvs bin]# chkc<strong>on</strong>fig --add jboss[root@cvs bin]# chkc<strong>on</strong>fig --list jbossjboss 0:off 1:off 2:off 3:<strong>on</strong> 4:<strong>on</strong> 5:<strong>on</strong> 6:off[root@cvs bin]# /etc/init.d/jboss startCMD_START = cd /usr/local/jboss/bin; /usr/local/jboss/bin/run.sh -c defaultand /etc/shadow after you create the user. Unfortunately, the JBoss programneeds to run a shell script, so you cannot set the shell to /sbin/nologin as isusual. Set the password for the user in /etc/shadow to x, which is completelyinvalid and will forbid login to the account by password.Finally, you will need to add the user jboss to any groups you created forJBoss management (such as local in our case). Truth be told, it would be agood idea to use the jboss user to install JBoss. It will avoid having to dealwith some file ownership and permissi<strong>on</strong> issues. If you do not do this, thesimplest way to get this init script working (you will get permissi<strong>on</strong> errors) isto runchmod -R g+w /usr/local/jbossThat will make the script work with the jboss user, provided jboss bel<strong>on</strong>gsto the group owner of the JBoss installati<strong>on</strong>.The final step is to copy your modified script to its final destinati<strong>on</strong> andrun chkc<strong>on</strong>fig to install it in all the runlevels (Example 20.5).You now have JBoss running. You can start and stop it with the script,and it will come up and shut down automatically depending <strong>on</strong> the runlevelyou switch to. Beauty, eh?20.5.3 Other Distributi<strong>on</strong>sYou d<strong>on</strong>’t need chkc<strong>on</strong>fig to set up equivalent scripts. In fact, the same scriptprovided by JBoss for RedHat will work with most distributi<strong>on</strong>s that use SystemV init system. You will have to copy the init script and then create theappropriate symlinks manually, or locate the automated setup tools for yourparticular distributi<strong>on</strong> (Debian, for example, has many such tools which youselect with their package management system).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!