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>
The following describes the entries in the file:
o Standard Header.
Code:
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM
"/usr/share/lib/xml/dtd/service_bundle.dtd.1">
o Comment Section.
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"
-->
o The name of the service. the type(manifest) indicates a simple service rather than a milestone, the package providing the service, and the service name.
On one of our server inetd service has stuck in transition state , tried restarting it but it does not do any thing and there is no associated inetd process for the same , how can i start it .. w/o rebooting it
svcs inetd
STATE STIME FMRI
online* 16:44:55... (3 Replies)
hi,
any body have a idea how to create a service in sunsolaries(like windows).is it possible to create a service?.if any body having idea help me?
regards
suresh (3 Replies)
Hello Friends,
Does anyone know how to create a startup script for Jboss on IBM AIX 5.3?
Please help me, I'd be highly grateful to you...
Thanks & Regards,
Vinit (0 Replies)
Hai Friends
I have written a DayTime server program using C socket.. I need to start the service automatically. My service directory is /etc/rc.d/init.d... my service name is DayTime present in /home/codebase/datetime/ directory.. Please help me
:confused: :confused: :confused:
Thanks in... (2 Replies)