<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>Hobbit Client as a Service on Solaris 10</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">Hi all</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">I have set up my Hobbit clients to run (and auto-start) as a service on Solaris 10.</FONT>

<BR><FONT SIZE=2 FACE="Arial">Thought I would share this with the list. </FONT>

<BR><FONT SIZE=2 FACE="Arial">(If I have reinvented the wheel, then apologies for cluttering the list, but I couldn't find anything like this anywhere else)</FONT></P>

<P><FONT SIZE=2 FACE="Arial">T.J. Are you still looking after the Hobbit Wiki?</FONT>

<BR><FONT SIZE=2 FACE="Arial">If enough people find this guide useful, it might be good to add it to the Wiki.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">For those of you familiar with Solaris 10, you should know about services, but for some, adding new ones is a little tricky.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">To get Hobbit working as a sevice we need to do the following.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Create the file</FONT> <FONT SIZE=2 FACE="Courier New">/var/svc/manifest/application/hobbit.xml</FONT>

<BR><FONT SIZE=2 FACE="Arial">In it, put the following </FONT>

<BR><FONT SIZE=2 FACE="Courier New"><?xml version="1.0"?></FONT>

<BR><FONT SIZE=2 FACE="Courier New"><!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"></FONT>

<BR><FONT SIZE=2 FACE="Courier New"><!--</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    Copyright 2007 Vernon Everett - vernon(a)everett.co.za</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    Free for use and distibution for non-commercial purposes.</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    No warranty exists either implicit or implied.</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    Standard disclaimer applies.</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    Commercial use is subject to license terms.</FONT>

<BR><FONT SIZE=2 FACE="Courier New">--></FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New"><service_bundle type='manifest' name='Hobbit-monitor:hobbit'></FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New"><service</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    name='application/hobbit'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    type='service'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">    version='1'></FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">        <dependency</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            name='filesystem'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            grouping='require_all'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            restart_on='none'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            type='service'></FONT>

<BR><FONT SIZE=2 FACE="Courier New">                <service_fmri value='svc:/system/filesystem/local'/></FONT>

<BR><FONT SIZE=2 FACE="Courier New">        </dependency></FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">        <dependency</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            name='multi-user-server'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            grouping='optional_all'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            type='service'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            restart_on='none'></FONT>

<BR><FONT SIZE=2 FACE="Courier New">                <service_fmri value='svc:/milestone/multi-user-server' /></FONT>

<BR><FONT SIZE=2 FACE="Courier New">        </dependency></FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">        <exec_method</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            type='method'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            name='start'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            exec='/usr/lib/hobbit/client/runclient.sh start'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            timeout_seconds='10'></FONT>

<BR><FONT SIZE=2 FACE="Courier New">      <method_context></FONT>

<BR><FONT SIZE=2 FACE="Courier New">        <method_credential user='hobbit'/></FONT>

<BR><FONT SIZE=2 FACE="Courier New">      </method_context></FONT>

<BR><FONT SIZE=2 FACE="Courier New">        </exec_method></FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">        <exec_method</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            type='method'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            name='stop'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            exec='/usr/lib/hobbit/client/runclient.sh stop'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            timeout_seconds='10'></FONT>

<BR><FONT SIZE=2 FACE="Courier New">      <method_context></FONT>

<BR><FONT SIZE=2 FACE="Courier New">        <method_credential user='hobbit' /></FONT>

<BR><FONT SIZE=2 FACE="Courier New">      </method_context></FONT>

<BR><FONT SIZE=2 FACE="Courier New">        </exec_method></FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">        <exec_method</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            type='method'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            name='restart'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            exec='/usr/lib/hobbit/client/runclient.sh restart'</FONT>

<BR><FONT SIZE=2 FACE="Courier New">            timeout_seconds='10'  ></FONT>

<BR><FONT SIZE=2 FACE="Courier New">      <method_context></FONT>

<BR><FONT SIZE=2 FACE="Courier New">        <method_credential user='hobbit' /></FONT>

<BR><FONT SIZE=2 FACE="Courier New">      </method_context></FONT>

<BR><FONT SIZE=2 FACE="Courier New">        </exec_method></FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">        <instance name='default' enabled='true' /></FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">        <stability value='Unstable' /></FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">        <template></FONT>

<BR><FONT SIZE=2 FACE="Courier New">                <common_name></FONT>

<BR><FONT SIZE=2 FACE="Courier New">                        <loctext xml:lang='C'></FONT>

<BR><FONT SIZE=2 FACE="Courier New">                                Hobbit Monitor Client</FONT>

<BR><FONT SIZE=2 FACE="Courier New">                        </loctext></FONT>

<BR><FONT SIZE=2 FACE="Courier New">                </common_name></FONT>

<BR><FONT SIZE=2 FACE="Courier New">        </template></FONT>

<BR><FONT SIZE=2 FACE="Courier New"></service></FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New"></service_bundle></FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Take note of lines 37, 47 and 57, the lines that start "exec=". You may need to edit the path to your Hob
bit start script.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">To avoid confusion or possible issues, shut down your hobbit client at this point using the runclient script.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Now, as root, run the command </FONT>

<BR><FONT SIZE=2 FACE="Courier New"># svccfg import /var/svc/manifest/application/hobbit.xml</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">We should now have a service called hobbit.</FONT>

<BR><FONT SIZE=2 FACE="Courier New"># svcs | grep hobbit</FONT>

<BR><FONT SIZE=2 FACE="Courier New">online          9:23:05 svc:/application/hobbit:default</FONT>

<BR><FONT SIZE=2 FACE="Arial">(It will probably have gone online at this point)</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">You can now treat it as you would a regular service.</FONT>

<BR><FONT SIZE=2 FACE="Arial">If it hasn't gone online, kick it off as normal.</FONT>

<BR><FONT SIZE=2 FACE="Courier New"># svcadm enable hobbit</FONT>

<BR><FONT SIZE=2 FACE="Arial">It may be necessary to do a disable and then an enable, but that should get it going.</FONT>

<BR><FONT SIZE=2 FACE="Arial">And because we have set the default as enabled, the service should start automagically when you do a reboot.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Confirm it's all good by doing a</FONT> <FONT SIZE=2 FACE="Courier New"># ps -efa | grep hobbit</FONT>

<BR><FONT SIZE=2 FACE="Arial">All the usual scripts should be running.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">If you don't want it as a serivce anymore, as root run</FONT>

<BR><FONT SIZE=2 FACE="Courier New"># svccfg delete hobbit.</FONT>

<BR><FONT SIZE=2 FACE="Arial">This will remove the service, and allow you to continue running it from the runclient script.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Have fun.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Regards</FONT>

<BR><FONT SIZE=2 FACE="Arial">     Vernon</FONT>
</P>
<BR>

<pre>
NOTICE: This email and any attachments are confidential. 
They may contain legally privileged information or 
copyright material. You must not read, copy, use or 
disclose them without authorisation. If you are not an 
intended recipient, please contact us at once by return 
email and then delete both messages and all attachments.
</pre></BODY>
</HTML>