View Single Post

   
  #5 (permalink)  
Old 03-17-2008, 06:04 AM
Martin Paul
 
Posts: n/a
Default Re: Service order of precendence at boot time

Guy Paulus wrote:
> Thanks for your information. I realize I forgot to mention that my OS is
> Solaris 10. Is there no need to introduce a dependency on spamd in
> sendmail's .xml file ?


No, you can put that into the xml file for spamd. As I just put spamd
into SMF myself, here's what I used:

-- The site-spamd file, to be put in /lib/svc/method/:

#!/bin/sh
#
PATH=/bin:/usr/sbin
export PATH

SPAMDBIN=/usr/local/sa/bin/spamd
SPAMDPID=/var/run/spamd.pid

case $1 in
'start')
$SPAMDBIN --daemonize --syslog-socket=inet --pidfile $SPAMDPID
;;

'restart')
test -f $SPAMDPID && kill -HUP `cat $SPAMDPID`
;;

'stop')
test -f $SPAMDPID && kill `cat $SPAMDPID`
;;

esac

To fully comply with the SMF standards, you might want to modify this
file to source /lib/svc/share/smf_include.sh and use "exit $SMF_EXIT_OK".

-- The spamd.xml file, to be put in /var/svc/manifest/site/:

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM
"/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='site:spamd'>

<service
name='site/spamd'
type='service'
version='1'>

<create_default_instance enabled='true' />

<single_instance/>

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

<dependency
name='network-service'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/network/service' />
</dependency>

<dependency
name='name-services'
grouping='require_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/milestone/name-services' />
</dependency>

<dependency
name='identity'
grouping='optional_all'
restart_on='refresh'
type='service'>
<service_fmri value='svc:/system/identity:domain' />
</dependency>

<dependency
name='system-log'
grouping='optional_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/system-log' />
</dependency>

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

<dependent
name='spamd_sendmail'
grouping='optional_all'
restart_on='none'>
<service_fmri value='svc:/network/smtp:sendmail' />
</dependent>

<dependent
name='spamd_multi-user'
grouping='optional_all'
restart_on='none'>
<service_fmri value='svc:/milestone/multi-user' />
</dependent>

<exec_method
type='method'
name='start'
exec='/lib/svc/method/site-spamd start'
timeout_seconds='60' />

<exec_method
type='method'
name='stop'
exec='/lib/svc/method/site-spamd stop'
timeout_seconds='60' />

<exec_method
type='method'
name='refresh'
exec='/lib/svc/method/site-spamd restart'
timeout_seconds='60' />

<stability value='Unstable' />

<template>
<common_name>
<loctext xml:lang='C'> spamd
</loctext>
</common_name>
</template>
</service>

</service_bundle>

After both files are in place, use:

svccfg import /var/svc/manifest/site/spamd.xml

to import the service into SMF. You can then use the usual commands to
enable/disable the service:

svcadm enable svc:/site/spamd:default
svcadm disable svc:/site/spamd:default

To check for dependencies/dependents, use:

svcs -d svc:/site/spamd
svcs -D svc:/site/spamd

The latter should show sendmail and multi-user.

Hope that helps,

Martin.
--
SysAdmin | Institute of Scientific Computing, University of Vienna
PCA | Analyze, download and install patches for Solaris
| http://www.par.univie.ac.at/solaris/pca/
Reply With Quote