Configuring JBoss to Use With Service Management Facility (SMF)William Pool (Puddle), June 2005
The Solaris 10 OS uses the Service Management Facility (SMF) to handle
services. Traditional means like To take advantage of the SMF in the Solaris 10 OS using JBoss, do the following. Note: Read the scripts and "change" the paths of jboss and your version of jboss accordingly! This does work for JBoss 3.x.x branches too! Create a service manifest file: /var/svc/manifest/network/jboss4.xml This contains the following:
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM
'/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<!--
William Pool (Puddle) 01/05
Service manifest for JBoss
E-mail: puddle@flipmotion.com
-->
<service_bundle type='manifest' name='JBoss4:jboss'>
<service
name='network/jboss'
type='service'
version='1'>
<create_default_instance enabled='false' />
<single_instance />
<dependency name='fs'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/system/filesystem/local' />
</dependency>
<!-- DATABASE NOTES
UnComment this block if you use MySQL/PostgreSQL. This will make sure
that MySQL/PostgreSQL is started before you start JBoss. This is an
example for MySQL. Please create an SMF service for MySQL / PostgreSQL.
<dependency name='mysql'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri
value='svc:/network/mysql' />
</dependency>
-->
<dependency name='net'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/network/loopback' />
</dependency>
<dependent
name='ssh_multi-user-server'
grouping='optional_all'
restart_on='none'>
<service_fmri
value='svc:/milestone/multi-user-server' />
</dependent>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/svc-jboss4 start'
timeout_seconds='-1'>
<method_context>
<method_credential user='jboss' group='jboss' />
</method_context>
</exec_method>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='-1'>
</exec_method>
<exec_method
type='method'
name='restart'
exec='/lib/svc/method/svc-jboss4 restart'
timeout_seconds='-1'>
</exec_method>
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'>
JBoss
</loctext>
</common_name>
<documentation>
<manpage title='jboss' section='1M'
manpath='/usr/share/man' />
</documentation>
</template>
</service>
</service_bundle>
Now create your "Service Method File" in
#!/usr/bin/sh
# William Pool (Puddle) 01/05
# SMF Method file for JBoss
# E-mail: puddle@flipmotion.com
#
# NOTE: If you start JBoss with su -c 'cmds' instead
# You "will" be able to start and stop it via root using the method file
# itself. However, it "does" confuse SMF. It's best to have the straight
# commands and let the actual SMF service do the user rights and permissions
# of execution. You've been WARNED! Use su -c 'cmds' at your own risk!
#
. /lib/svc/share/smf_include.sh
case $1 in
'start')
echo "starting jboss.."
/opt/software/jboss-4.0.1/bin/run.sh & >/dev/null 2> /dev/null
;;
'stop')
echo "stopping jboss.."
/opt/software/jboss-4.0.1/bin/shutdown.sh -S &
pkill java
;;
'restart')
stop
# give stuff some time to stop before we restart
sleep 35
# protect against any services that can't stop before we restart (warning
this kills all Java instances running as 'jboss' user)
pkill java
start
;;
*)
echo "Usage: $0 { start | stop | restart }"
exit 1
;;
esac
#---EOF
Now fix the permissions for the two files created: chown root:bin /lib/svc/method/svc-jboss4 chmod 555 /lib/svc/method/svc-jboss4 chown root:sys /var/svc/manifest/network/jboss4.xml chmod 444 /var/svc/manifest/network/jboss4.xml Import the service into the service repository: # svccfg import /var/svc/manifest/network/jboss4.xml Enable the service: # svcadm -v enable jboss References for Further Information
The information and links on this page have been provided by a BigAdmin user. The submitter is solely responsible for such information and links. Sun is not responsible for the availability of external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. Sun will not be responsible or liable, directly or indirectly, for any actual or alleged damage or loss caused by or in connection with use of or reliance on the information posted here, or goods or services available on or through any external site or resource. Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License. |
| |||