Hobbit Client as a Service on Solaris 10

Everett, Vernon Vernon.Everett at woodside.com.au
Thu Dec 6 02:25:26 CET 2007


Hi all

I have set up my Hobbit clients to run (and auto-start) as a service on
Solaris 10.
Thought I would share this with the list. 
(If I have reinvented the wheel, then apologies for cluttering the list,
but I couldn't find anything like this anywhere else)

T.J. Are you still looking after the Hobbit Wiki?
If enough people find this guide useful, it might be good to add it to
the Wiki.

For those of you familiar with Solaris 10, you should know about
services, but for some, adding new ones is a little tricky.
To get Hobbit working as a sevice we need to do the following.

Create the file /var/svc/manifest/application/hobbit.xml
In it, put the following 
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM
"/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
    Copyright 2007 Vernon Everett - vernon(a)everett.co.za
    Free for use and distibution for non-commercial purposes.
    No warranty exists either implicit or implied.
    Standard disclaimer applies.
    Commercial use is subject to license terms.
-->

<service_bundle type='manifest' name='Hobbit-monitor:hobbit'>

<service
    name='application/hobbit'
    type='service'
    version='1'>

        <dependency
            name='filesystem'
            grouping='require_all'
            restart_on='none'
            type='service'>
                <service_fmri value='svc:/system/filesystem/local'/>
        </dependency>

        <dependency
            name='multi-user-server'
            grouping='optional_all'
            type='service'
            restart_on='none'>
                <service_fmri value='svc:/milestone/multi-user-server'
/>
        </dependency>

        <exec_method
            type='method'
            name='start'
            exec='/usr/lib/hobbit/client/runclient.sh start'
            timeout_seconds='10'>
      <method_context>
        <method_credential user='hobbit'/>
      </method_context>
        </exec_method>

        <exec_method
            type='method'
            name='stop'
            exec='/usr/lib/hobbit/client/runclient.sh stop'
            timeout_seconds='10'>
      <method_context>
        <method_credential user='hobbit' />
      </method_context>
        </exec_method>

        <exec_method
            type='method'
            name='restart'
            exec='/usr/lib/hobbit/client/runclient.sh restart'
            timeout_seconds='10'  >
      <method_context>
        <method_credential user='hobbit' />
      </method_context>
        </exec_method>

        <instance name='default' enabled='true' />

        <stability value='Unstable' />

        <template>
                <common_name>
                        <loctext xml:lang='C'>
                                Hobbit Monitor Client
                        </loctext>
                </common_name>
        </template>
</service>

</service_bundle>

Take note of lines 37, 47 and 57, the lines that start "exec=". You may
need to edit the path to your Hobbit start script.

To avoid confusion or possible issues, shut down your hobbit client at
this point using the runclient script.

Now, as root, run the command 
# svccfg import /var/svc/manifest/application/hobbit.xml

We should now have a service called hobbit.
# svcs | grep hobbit
online          9:23:05 svc:/application/hobbit:default
(It will probably have gone online at this point)

You can now treat it as you would a regular service.
If it hasn't gone online, kick it off as normal.
# svcadm enable hobbit
It may be necessary to do a disable and then an enable, but that should
get it going.
And because we have set the default as enabled, the service should start
automagically when you do a reboot.

Confirm it's all good by doing a # ps -efa | grep hobbit
All the usual scripts should be running.

If you don't want it as a serivce anymore, as root run
# svccfg delete hobbit.
This will remove the service, and allow you to continue running it from
the runclient script.

Have fun.

Regards
     Vernon



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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20071206/3c2f4c7c/attachment.html>


More information about the Xymon mailing list