Its been quite a while since I've blogged on anything. So I'll try to
pick up with something useful. I was tasked by a collegue to create a script
that would ensure that his Sun Java System Application Server instance would
restart if his Solaris 10 server ever went down. For this example we are talking
about normal power outages/flickers occuring in a home. Not anything you would
face in a reliable data center. The SJSAS documentation
describes how to do this with /etc/inittab. I decided to try some of the new
capabilities in S10, mainly SMF.
I borrowed from these 3 sources:
http://www.cuddletech.com/blog/pivot/entry.php?id=326
http://www.sun.com/bigadmin/content/submitted/config_smf.html
http://www.sun.com/bigadmin/content/selfheal/sdev_intro.html
Step 1) Create the SMF description. Here is one for the Application Server. You should chanage DOMAINNAME to be the name of the domain you wish to restart. Currently this script will only start 1 domain. I called this SMF description sjsas.xml
Step 2) You will need to copy this file and fix permissions for it. I placed this file in the applications directory underneath the manifest dir.
Step 3) Import the service description
Step 4) Enable the service
This seems to work just fine for me. I also created a SMF description for Sun Java System Web Server. I'll post that tomorrow
I borrowed from these 3 sources:
http://www.cuddletech.com/blog/pivot/entry.php?id=326
http://www.sun.com/bigadmin/content/submitted/config_smf.html
http://www.sun.com/bigadmin/content/selfheal/sdev_intro.html
Step 1) Create the SMF description. Here is one for the Application Server. You should chanage DOMAINNAME to be the name of the domain you wish to restart. Currently this script will only start 1 domain. I called this SMF description sjsas.xml
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<!--
Jeff Bounds 09/12
Service manifest for Sun Java System Application Server
-->
<service_bundle type='manifest' name='SUNWappserver:appserver'>
<service name='application/sjsas' 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>
<dependency name='net' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/network/initial' />
</dependency>
<exec_method type='method' name='start' exec='/opt/SUNWappserver/appserver/bin/asadmin start-domain DOMAINNAME' timeout_seconds='-1'>
<method_context>
<method_credential user='appservd' group='appservd' />
</method_context>
</exec_method>
<exec_method type='method' name='stop' exec='/opt/SUNWappserver/appserver/bin/asadmin stop-domain DOMAINNAME' timeout_seconds='-1'>
</exec_method>
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'>
SJSAS
</loctext>
</common_name>
</template>
</service>
</service_bundle>
Step 2) You will need to copy this file and fix permissions for it. I placed this file in the applications directory underneath the manifest dir.
chown root:sys /var/svc/manifest/application/sjsas.xml
chmod 444 /var/svc/manifest/application/sjsas.xml
Step 3) Import the service description
svccfg import /var/svc/manifest/application/sjsas.xml
Step 4) Enable the service
svcadm -v enable sjsas
This seems to work just fine for me. I also created a SMF description for Sun Java System Web Server. I'll post that tomorrow