-
1. Re: HOWTO: Configuring Solaris 10 SMF (Using svcs/svcadm wi
rotaecho Jan 9, 2005 1:24 PM (in response to rotaecho)Okay the post got messed up by some twit I Think here it is again folks:
Solaris 10 uses SMF to handle services. Traditional means of /etc/rc?.d
scripts still work, but in legacy means.
To take advantage of the SMF with Solaris 10 with JBoss do the following:
This works on 4.0.0 and 4.0.1 just change the manifest file. I also have a PKGADD package with everything good to go and starts up etc. Let me know if interested.
Create a service manifest file:
/var/svc/manifest/network/jboss.xml
That 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
-->
<service_bundle type='manifest' name='JBoss325:jboss'>
<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 name='net'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/network/loopback' />
<dependent
name='ssh_multi-user-server'
grouping='optional_all'
restart_on='none'>
<service_fmri
value='svc:/milestone/multi-user-server' />
<exec_method
type='method'
name='start'
exec='/lib/svc/method/svc-jboss 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-jboss restart'
timeout_seconds='-1'>
</exec_method>
<common_name>
<loctext xml:lang='C'>
JBoss
</common_name>
</service_bundle>
Now Create your "Service Method File" in /lib/svc/method/
# more svc-jboss
#! /bin/sh
# Solaris 2.x Init script
#
. /lib/svc/share/smf_include.sh
case $1 in
'start')
echo "starting jboss.."
su jboss -c '/opt/jboss/bin/run.sh & >
/dev/null 2> /dev/null'
;;
'stop')
echo "stopping jboss.."
su jboss -c '/opt/jboss/bin/shutdown.sh -S &'
su jboss -c 'pkill java'
;;
'restart')
stop
# give stuff some time to stop before we restart
sleep 60
# protect against any services that can't stop before we restart (warning
this kills all Java instances running as 'jboss' user)
su jboss -c 'pkill java'
start
;;
*)
echo "Usage: $0 { start | stop | restart }"
exit 1
;;
esac
#
Now fix the permissions for the two files created:
chown root:bin /lib/svc/method/svc-jboss
chmod 555 /lib/svc/method/svc-jboss
chown root:sys /var/svc/manifest/network/jboss.xml
chmod 444 /var/svc/manifest/network/jboss.xml
Import the Service into the service repository
# svccfg import /var/svc/manifest/network/jboss.xml
Enable the Service
# svcadm -v enable jboss
Reference for further information:
http://docs.sun.com/app/docs/coll/47.16?q=solaris+10
http://www.sun.com/bigadmin/content/selfheal/smf-quickstart.html
http://www.sun.com/bigadmin/content/selfheal/sdev_intro.html