Carl Brewer wrote:
[chomp]
Following up to my own mail with how I got it working :
Created two methods, and two manifest files :
These are the methods - very similar to init.d scripts.
/lib/svc/method/smbd :
#!/sbin/sh
#
#
. /lib/svc/share/smf_include.sh
SMB_HOME=/usr/sfw/sbin
CONF_FILE=/etc/sfw/smb.conf
PIDFILE=/var/samba/locks/smbd.pid
[ ! -f ${CONF_FILE} ] && exit $SMF_EXIT_ERR_CONFIG
case "$1" in
start)
/bin/rm -f ${PIDFILE}
exec ${SMB_HOME}/smbd -D 2>&1 &
;;
stop)
PID=`head -1 ${PIDFILE}`
kill -TERM ${PID}
;;
*)
echo "Usage: $0 {start|stop)"
exit 1
;;
esac
/lib/svc/method/nmbd :
#!/sbin/sh
#
#
. /lib/svc/share/smf_include.sh
SMB_HOME=/usr/sfw/sbin
CONF_FILE=/etc/sfw/smb.conf
PIDFILE=/var/samba/locks/nmbd.pid
[ ! -f ${CONF_FILE} ] && exit $SMF_EXIT_ERR_CONFIG
case "$1" in
start)
/bin/rm -f ${PIDFILE}
exec ${SMB_HOME}/nmbd -D 2>&1 &
;;
stop)
PID=`head -1 ${PIDFILE}`
kill -TERM ${PID}
;;
*)
echo "Usage: $0 {start|stop)"
exit 1
;;
esac
And the manifests.
/var/svc/manifest/application/smbd.xml :
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM
"/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
-->
<service_bundle type='manifest' name='Vivitec:smbd'>
<service
name='application/smbd'
type='service'
version='1'>
<create_default_instance enabled='true' />
<single_instance/>
<!-- milestone/multi-user-server ?
-->
<dependency
name='name-services'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/milestone/name-services'
/>
</dependency>
<dependency
name='local-filesystems'
type='service'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/system/filesystem/local'
/>
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/smbd start'
timeout_seconds='60' />
<exec_method
type='method'
name='stop'
exec='/lib/svc/method/smbd stop'
timeout_seconds='60' />
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'> Samba
</loctext>
</common_name>
</template>
</service>
</service_bundle>
/var/svc/manifest/application/nmbd.xml :
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM
"/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
-->
<service_bundle type='manifest' name='Vivitec:nmbd'>
<service
name='application/nmbd'
type='service'
version='1'>
<!--
We need to mark this as enabled in the seed, due to
svc.startd not waiting for manifest import before
making decisions on whether to start sulogin (see
6194195).
-->
<create_default_instance enabled='true' />
<single_instance/>
<!-- milestone/multi-user-server ?
-->
<dependency
name='name-services'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/milestone/name-services'
/>
</dependency>
<dependency
name='local-filesystems'
type='service'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/system/filesystem/local'
/>
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/nmbd start'
timeout_seconds='60' />
<exec_method
type='method'
name='stop'
exec='/lib/svc/method/nmbd stop'
timeout_seconds='60' />
<stability value='Unstable' />
<template>
<common_name>
<loctext xml:lang='C'> Samba
</loctext>
</common_name>
</template>
</service>
</service_bundle>
To make them live, as root :
svccfg -v import /var/svc/manifest/application/nmbd.xml
svccfg -v import /var/svc/manifest/application/smbd.xml
To check them :
svcs -vx nmbd
svcs -vx smbd
This is only a very dirty installation, but maybe it'll help
someone? Note, this is for SMF with the Samba as distributed with
Solaris 10. Hacking it to work with other releases should be a
simple cut & shut in the method files above to locate the
smbd & nmbd (and winbindd if required? what does it do again?!).
More examples of SMF can be found here :
http://www.rfcgr.mrc.ac.uk/~ptribble/Solaris/smf.html
(that's what I used as an example, it's not my page or my work)
Carl