![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems . |
LinkBacks (?)
LinkBack to this Thread: http://www.unix.com/sun-solaris/32936-solaris-10-add-new-svc.html
|
||||
| Posted By | For | Type | Date | |
| undertow's solaris Bookmarks on Delicious | This thread | Refback | 12-22-2008 12:08 PM | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| run xclock from local solaris to remote solaris | panchpan | SUN Solaris | 9 | 06-30-2008 10:05 AM |
| jumpstart Solaris 10 on Solaris 9 server | salty | SUN Solaris | 5 | 01-22-2008 03:57 PM |
| Disk Mirror in Solaris 9 via Solaris Volume Manager | deal732 | SUN Solaris | 3 | 05-02-2007 11:43 AM |
| Running Solaris Sparc Apps on X86 Solaris | stocksj | UNIX for Dummies Questions & Answers | 1 | 12-12-2006 05:13 PM |
| trouble auto connecting ssh 3.6.1 (Solaris 8) to ssh 3.0.1 (Solaris 6) | falklandtim | SUN Solaris | 6 | 03-01-2005 08:45 AM |
![]() |
|
|
LinkBack (1) | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||||
|
Yes you have to create the xml file yourself..
- Create your shell start stop script and save it in /usr/local/svc/method/myservice - chmod 755 /usr/local/svc/method/myservice - Create your xml file and save it in /var/svc/manifest/site/myservice.xml - Incorporate the script into the SMF using svccfg utility Code:
svccfg import /var/svc/manifest/site/myservice.xml replace myservice with the name of the service you are adding. Last edited by Tornado; 11-16-2006 at 03:19 AM.. |
|
|||||
|
This bit of info might be of use to you..
http://www.sun.com/bigadmin/content/...dev_intro.html I am going through the doco I have, I will have to type a couple of pages worth inbetween doing my other work so it will take me a while to type it up for you.. |
|
|||||
|
The general steps required are:
o Determine the proccess for starting and stopping your service. o Establish a name for the service, and the category this service falls into. o Determine whether your service runs multiple instances. o Identify any dependency relationships between this service and any other service. o If a script is required to start and stop the process, create the script and place it in a local directory such as /usr/local/svc/method o Create a service manifest file for your service. This file describes the service and any dependency relationships. Service manifests are pulled into the repository either by using svccfg command or at boot time. o Incorporate the scripts into SMF using the svccfg utility. The following displays an example. Code:
# vi /usr/local/svc/method/newservice
#!/sbin/sh
#
# Copyright (c) 1995, 1997-1999 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident "@(#)newservice 1.14 06/11/17 SMI"
case "$1" in
'start')
/usr/bin/newservice &
;;
'stop')
/usr/bin/pkill -x -u 0 newservice
;;
*0
echo "Usage: $0 { start | stop }"
;;
esac
exit 0
# chmod 544 /usr/local/svc/method/newservice
# cd /var/svc/manifest/site
# vi newservice.xml
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
Copyright 2004 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
pragma ident "@(#)newservice.xml 1.2 04/08/09 SMI"
-->
<service_bundle type='manifest' name='OPTnew:newservice'>
<service
name='site/newservice'
type='service'
version='1'
<single_instance/>
<dependency
name='usr'
type='service'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<dependency
name='newservice'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/milestone/multi-user'/>
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/newservice start'
timeout_seconds='30' />
<exec_method
type='method'
name='stop'
exec='/lib/svc/method/newservice stop'
timeout_seconds='30' />
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='transient' />
</property_group>
<instance name='default' enabled='true' />
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'>
New Service
</loctext>
</common_name>
</template>
</service>
</service_bundle>
o Standard Header. Code:
<?xml version="1.0"?> <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> Code:
<!--
Copyright 2004 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
pragma ident "@(#)newservice.xml 1.2 04/08/09 SMI"
-->
Code:
<service_bundle type='manifest' name='OPTnew:newservice'> Code:
<service
name='site/newservice'
type='service'
version='1'
Code:
<single_instance/> Code:
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='transient' />
</property_group>
Code:
<exec_method
type='method'
name='start'
exec='/lib/svc/method/newservice start'
timeout_seconds='30' />
<exec_method
type='method'
name='stop'
exec='/lib/svc/method/newservice stop'
timeout_seconds='30' />
Code:
<dependency
name='usr'
type='service'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
Code:
<dependency
name='newservice'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/milestone/multi-user'/>
</dependency>
Code:
<instance name='default' enabled='true' />
<stability value='Unstable' />
Code:
<template>
<common_name>
<loctext xml:lang='C'>
New Service
</loctext>
</common_name>
</template>
This is done by running the svccfg utility: Code:
# svccfg import /var/svc/manifest/site/newservice.xml Code:
# svcs newservice STATE STIME FMRI online 8:57:35 svc:/site/newservice:default # Code:
# svcadm -v disable site/newservice site/newservice disabled. # svcs newservice STATE STIME FMRI disabled 9:07:15 svc:/site/newservice:default # svcadm -v enable site/newservice site/newservice enabled. # svcs newservice STATE STIME FMRI online 9:17:01 svc:/site/newservice:default # Code:
# svcs -d milestone/multi-user:default STATE STIME FMRI disabled 8:43:16 svc:/platform/sun4u/sf880drd:default online 8:43:16 svc:/milestone/name-services:default online 8:43:33 svc:/system/rmtmpfiles:default online 8:43:42 svc:/network/rpc/bind:default online 8:43:46 svc:/milestone/single-user:default online 8:43:46 svc:/system/utmp:default online 8:43:47 svc:/system/system-log:default online 8:43:49 svc:/system/filesystem/local:default online 8:44:01 svc:/system/mdmonitor:default online 9:17:01 svc:/site/newservice:default # |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|