Hobbit Client as a Service on Solaris 10
list Vernon Everett
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.
list Johann Eggers
This is already documented on The Shire: http://www.trantor.org/theshire/doku.php/addons:hobbitsmf
▸
From: Everett, Vernon [mailto:user-9da1a1882f49@xymon.invalid] Sent: Donnerstag, 6. Dezember 2007 02:25
To: user-ae9b8668bcde@xymon.invalid
Subject: [hobbit] Hobbit Client as a Service on Solaris 10
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 Hob bit 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.
list T.J. Yang
Thanks for the sharing from Johann and Vernon. I quickly import these two notes into hobbit wiki at http://en.wikibooks.org/wiki/System_Monitoring_with_Hobbit/Other_Docs/FAQ#Administration_FAQ perfect the wiki notes will be done later(or may not).
Are you still looking after the Hobbit Wiki?
Yes. but at not active recently due to other priorities. One of my priorities related to hobbit is, I am looking at using R1. as framework to produce a hobbit book. The book will draw materials from email list and hobbit wikis. keywords of mercurial book framework I like are: TeX,graphviz,inkscape(svg),makefile, book with indexes. Download mercurial book at R2 to take a look. I really wish someday hobbit project has book like this. R1: http://hg.serpentine.com/mercurial/book/ R2: http://hgbook.red-bean.com/hgbook.pdf T.J. Yang
▸
Date: Thu, 6 Dec 2007 11:47:48 +0100 From: user-769b09132207@xymon.invalid To: user-ae9b8668bcde@xymon.invalid Subject: RE: [hobbit] Hobbit Client as a Service on Solaris 10 This is already documented on The Shire: http://www.trantor.org/theshire/doku.php/addons:hobbitsmf From: Everett, Vernon [mailto:user-9da1a1882f49@xymon.invalid] Sent: Donnerstag, 6. Dezember 2007 02:25 To: user-ae9b8668bcde@xymon.invalid Subject: [hobbit] Hobbit Client as a Service on Solaris 10 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
Hobbit Monitor Client
▸
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.
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.
You keep typing, we keep giving. Download Messenger and join the i’m Initiative now. http://im.live.com/messenger/im/home/?source=TAGLM