Repository navigation
Closed
Description
Hi there!
There's no SMF support for clamsmtp package, so I've written one (by sort-of copy-pasting the relevant pieces from clamd's SMF) and the relevant rc script from FreeBSD.
My SMF file looks like this:
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='pkgsrc/clamsmtp' type='service' version='0'>
<create_default_instance enabled='false'/>
<single_instance/>
<dependency name='fs' 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='clamd' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='/pkgsrc/clamav:clamd'/>
</dependency>
<dependency name='config' grouping='require_all' restart_on='none' type='path'>
<service_fmri value='file:///opt/local/etc/clamsmtpd.conf'/>
</dependency>
<method_context working_directory='/var/clamav'>
<method_credential group='clamav' user='clamav'/>
</method_context>
<exec_method name='start' type='method' exec='/opt/local/lib/svc/method/clamsmtp start' timeout_seconds='0'/>
<exec_method name='stop' type='method' exec='/opt/local/lib/svc/method/clamsmtp stop' timeout_seconds='0'/>
<exec_method name='refresh' type='method' exec='/opt/local/lib/svc/method/clamsmtp refresh' timeout_seconds='0'/>
<property_group name="startd" type="framework">
<propval name="duration" type="astring" value="contract"/>
<propval name="ignore_error" type="astring" value="core,signal"/>
</property_group>
<stability value='Evolving'/>
<template>
<common_name>
<loctext xml:lang='C'>ClamAV SMTP filter for postfix daemon</loctext>
</common_name>
</template>
</service>
</service_bundle>And the relevant rc script (/opt/local/lib/svc/method/clamsmtp) looks like this:
#!/sbin/sh
#
# $NetBSD: clamd.sh,v 1.1 2014/03/11 14:34:39 jperkin Exp $
#
# Init script for clamd(8)
#
. /lib/svc/share/smf_include.sh
PIDFILE="/var/clamav/clamsmtp.pid"
CONFIGFILE="/opt/local/etc/clamsmtpd.conf"
case "$1" in
start)
/opt/local/sbin/clamsmtpd -f ${CONFIGFILE} -p ${PIDFILE}
;;
stop)
kill `/usr/bin/head -1 ${PIDFILE}`
;;
refresh)
# Re-open any log files and reload the database
kill -HUP `/usr/bin/head -1 ${PIDFILE}`
;;
*)
echo "Usage: $0 {start|stop|refresh}" >&2
exit 1
;;
esacThese are just my 2c. I suppose both files can be refactored to be more complete, but I'm new in Solaris-based OS', so... :)
Metadata
Metadata
Assignees
Labels
No labels
Activity
mamash commentedon Jan 22, 2018
Thanks, I implemented something like this and committed to upstream pkgsrc. Note that SMF itself has a built-in process manager, so things like PID files are typically not needed and for simply daemons not even start up scripts are required (i.e. binaries can be called directly).
gallery-dl: Update net/gallery-dl to 1.2.0
net/ruby-amq-protocol: update to 2.3.0
Update to 0.12.0. From the changelog:
libsixel: update to 1.8.2.
Update to 3.2.1
Update to 1.642
Update to 0.8.0
cups-filters: Update print/cups-filters to 1.21.4
cups-filters: Update print/cups-filters to 1.21.5
glib-networking: update to 2.60.1.
gdk-pixbuf2*: update to 2.38.1
ruby-memoist: update to 0.16.2.
132 remaining items
net/ruby-snmp: update to 1.3.4
p5-XML-Parser: update to 2.48.
comms/picocom: update to version 3.1
gnome-nibbles: update to 4.5.0.
py-puremagic: update to 2.0.0.
net/ruby-snmp: update to 1.3.4
p5-XML-Parser: update to 2.48.
comms/picocom: update to version 3.1
samurai: update to 1.3.
Update to 0.41
textproc/treemd: update to 0.7.0
devel/gitpane: update to 0.16.0
Update to 1.31
Update to 1.31
py-typing-inspection: update to 0.4.5.