As you may already know, Solaris 10 has introduced the service
management facility to replace init.d scripts for running services.
I've recently been migrating some servers from Solaris 9 to Solaris
10, and as a part of this I've converted all init.d scripts to SMF
manifests and methods. I'll attach the ones that I'm using. I've
designed them as one service with four instances. All start out in
the disabled state:
# svcs -a | grep dcc
disabled Sep_12 svc:/site/dcc-server:dccm
disabled Sep_12 svc:/site/dcc-server:grey
disabled Sep_12 svc:/site/dcc-server:dccifd
disabled Sep_12 svc:/site/dcc-server:dccd
In my case, I'll enable the `dccd', `grey', and `dccm' instances,
leaving the `dccifd' disabled. The `dccd' instance looks like this:
# svcs -l svc:/site/dcc-server:dccd
fmri svc:/site/dcc-server:dccd
name Distributed Checksum Clearinghouse Daemons
enabled false
state disabled
next_state none
state_time September 12, 2008 11:09:29 AM CDT
restarter svc:/system/svc/restarter:default
dependency require_all/none svc:/site/wait-central (online)
dependency require_all/none svc:/milestone/name-services (online)
dependency require_all/none svc:/system/system-log (online)
There's one dependancy on a local service (svc:/site/wait-central)
that most people won't want to include. It can be edited out of the
manifest. Likewise, the method script contains a reference to my
DCC directory (/usr/local/dcc). That will differ for other people.
Otherwise, both can be used without further changes.
--
-Gary Mills- -Unix Support- -U of M Academic Computing and Networking-
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='dcc-dccd'>
<service name='site/dcc-server' type='service' version='0'>
<dependency name='central' grouping='require_all' restart_on='none'
type='service'>
<service_fmri value='svc:/site/wait-central'/>
</dependency>
<dependency name='ns' grouping='require_all' restart_on='none'
type='service'>
<service_fmri value='svc:/milestone/name-services'/>
</dependency>
<dependency name='log' grouping='require_all' restart_on='none'
type='service'>
<service_fmri value='svc:/system/system-log'/>
</dependency>
<exec_method name='start' type='method'
exec='/lib/svc/method/site/dcc-server %i %m' timeout_seconds='60'>
<method_context>
<method_credential user='root' group='root'/>
</method_context>
</exec_method>
<exec_method name='stop' type='method'
exec='/lib/svc/method/site/dcc-server %i %m' timeout_seconds='60'>
<method_context>
<method_credential user='root' group='root'/>
</method_context>
</exec_method>
<property_group name='startd' type='framework'>
<propval name='ignore_error' type='astring' value='core,signal'/>
</property_group>
<instance name='dccd' enabled='false'>
<dependent name='dcc-dccd_multi-user-server' restart_on='none'
grouping='optional_all'>
<service_fmri value='svc:/milestone/multi-user-server'/>
</dependent>
</instance>
<instance name='dccifd' enabled='false'>
<dependent name='dcc-dccifd_multi-user-server' restart_on='none'
grouping='optional_all'>
<service_fmri value='svc:/milestone/multi-user-server'/>
</dependent>
</instance>
<instance name='dccm' enabled='false'>
<dependent name='dcc-dccm_sendmail' restart_on='none'
grouping='optional_all'>
<service_fmri value='svc:/site/sendmail:default'/>
</dependent>
</instance>
<instance name='grey' enabled='false'>
<dependent name='dcc-grey_multi-user-server' restart_on='none'
grouping='optional_all'>
<service_fmri value='svc:/milestone/multi-user-server'/>
</dependent>
</instance>
<stability value='Unstable'/>
<template>
<common_name>
<loctext xml:lang='C'>Distributed Checksum Clearinghouse
Daemons</loctext>
</common_name>
</template>
</service>
</service_bundle>
#!/sbin/sh
#
# Method for the Distributed Checksum Clearinghouse Daemons
# Run as root:root by the restarter
#
. /lib/svc/share/smf_include.sh
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin; export PATH
# Copyright (c) 2008 by Rhyolite Software, LLC
#
# This agreement is not applicable to any entity which sells anti-spam
# solutions to others or provides an anti-spam solution as part of a
# security solution sold to other entities, or to a private network
# which employs the DCC or uses data provided by operation of the DCC
# but does not provide corresponding data to other users.
#
# Permission to use, copy, modify, and distribute this software without
# changes for any purpose with or without fee is hereby granted, provided
# that the above copyright notice and this permission notice appear in all
# copies and any distributed versions or copies are either unchanged
# or not called anything similar to "DCC" or "Distributed Checksum
# Clearinghouse".
#
# Parties not eligible to receive a license under this agreement can
# obtain a commercial license to use DCC by contacting Rhyolite Software
# at [EMAIL PROTECTED]
#
# A commercial license would be for Distributed Checksum and Reputation
# Clearinghouse software. That software includes additional features. This
# free license for Distributed ChecksumClearinghouse Software does not in any
# way grant permision to use Distributed Checksum and Reputation Clearinghouse
# software
#
# THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE, LLC DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE, LLC
# BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# Rhyolite Software DCC 1.3.86-1.34 $Revision$
# Generated automatically from rcDCC.in by configure.
DCC_HOMEDIR=/usr/local/dcc
DCC_LIBEXEC=/usr/local/dcc/libexec # in case dcc_conf has disappeared
. $DCC_HOMEDIR/dcc_conf
if test -z "$DCC_RUNDIR" -a -n "$DCCM_RUNDIR"; then
# deal with old dcc_conf files
DCC_RUNDIR="$DCCM_RUNDIR"
fi
DEBUG=
DAEMON="$1"
case "$2" in
start|restart|reload)
echo "Starting dcc-server"
if test -z "$DAEMON" -o "$DAEMON" = dccd; then
$DCC_LIBEXEC/start-dccd $DEBUG
fi
if test -z "$DAEMON" -o "$DAEMON" = grey; then
$DCC_LIBEXEC/start-grey $DEBUG
fi
if test -z "$DAEMON" -o "$DAEMON" = dccm; then
ulimit -n 5120
$DCC_LIBEXEC/start-dccm $DEBUG
fi
if test -z "$DAEMON" -o "$DAEMON" = dccifd; then
$DCC_LIBEXEC/start-dccifd $DEBUG
fi
;;
stop)
echo "Stopping dcc-server"
# stop dccm and dccifd
PIDS=
if test -z "$DAEMON" -o "$DAEMON" = dccm; then
PIDS="$PIDS `cat $DCC_RUNDIR/dccm.pid 2>/dev/null`"
PIDS="$PIDS `cat $DCC_HOMEDIR/dccm.pid 2>/dev/null`"
fi
if test -z "$DAEMON" -o "$DAEMON" = dccifd 2>/dev/null; then
PIDS="$PIDS `cat $DCC_RUNDIR/dccifd.pid 2>/dev/null`"
PIDS="$PIDS `cat $DCC_HOMEDIR/dccifd.pid 2>/dev/null`"
fi
if expr "$PIDS" : '.*[0-9]' >/dev/null; then
# signal the process group because on Linux systems signaling the
# main process for a threaded application does not work.
/bin/kill -15 $PIDS
fi
# Tell dccd about operating system shutdown, including deleting
# dcc_db.hash, which will be rebuilt by dbclean when dccd is restarted.
if test -z "$DAEMON" -o "$DAEMON" = dccd; then
$DCC_LIBEXEC/stop-dccd -S $DEBUG
fi
if test -z "$DAEMON" -o "$DAEMON" = grey; then
$DCC_LIBEXEC/stop-dccd -G -S $DEBUG
fi
;;
*)
echo "Usage: $0 {dccd|dccifd|dccm|grey} {start|restart|reload|stop}"
exit 1
;;
esac
exit $SMF_EXIT_OK
#!/end