Sysadmin > SolarIs > SmfManifests > EximSmfManifest

SMF manifest for exim

lightly modified version coming with pkgsrc

I just added the greylistd dependency.

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="exim">
    <service name="pkgsrc/exim" type="service" version="1">

        <create_default_instance enabled="false"/>
        <single_instance/>

        <dependency name="network" grouping="require_all" restart_on="error" type="service">
            <service_fmri value="svc:/milestone/network:default"/>
        </dependency>

        <dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
            <service_fmri value="svc:/system/filesystem/local"/>
        </dependency>

        <dependency name="greylistd" grouping="require_all" restart_on="error" type="service">
            <service_fmri value="svc:/opt/greylistd:default"/>
        </dependency>

        <method_context working_directory="/">
            <method_credential user="mail" group="mail"/>
        </method_context>

        <exec_method type="method" name="start" exec="/opt/pkg/sbin/exim -C %{config_file} -bdf" timeout_seconds="60"/>

        <exec_method type="method" name="stop" exec=":kill" timeout_seconds="60"/>

        <property_group name="startd" type="framework">
            <propval name="duration" type="astring" value="child"/>
            <propval name="ignore_error" type="astring" value="core,signal"/>
        </property_group>

        <property_group name="application" type="application">
            <propval name="config_file" type="astring" value="/opt/pkg/etc/exim/configure" />
        </property_group>

        <stability value="Evolving"/>

        <template>
            <common_name>
                <loctext xml:lang="C">
                    Exim Mailservice (MTA)
                </loctext>
            </common_name>
        </template>
    </service>
</service_bundle>


old version with manifest and method

exim manifest /var/svc/manifest/network/smtp-exim

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
        Copyright (C) Stephan Pietzko
        http://s2p.de
-->

<service_bundle type='manifest' name='pkgsrc:exim'>

<service
        name='network/smtp'
        type='service'
        version='1'>

        <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>

        <instance name='exim' enabled='false'>

            <dependency
                name='config-file'
                grouping='require_all'
                restart_on='refresh'
                type='path'>
                    <service_fmri value='file://localhost/opt/pkg/etc/exim/configure' />
            </dependency>

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

            <dependency
                name='nsswitch'
                grouping='require_all'
                restart_on='refresh'
                type='path'>
                    <service_fmri value='file://localhost/etc/nsswitch.conf' />
            </dependency>

            <!--
            If autofs is enabled, wait for it to get users' home
            directories.
            -->
            <dependency
                name='autofs'
                grouping='optional_all'
                restart_on='none'
                type='service'>
                    <service_fmri value='svc:/system/filesystem/autofs' />
            </dependency>

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

            <exec_method
                type='method'
                name='start'
                exec='/opt/pkg/etc/rc.d/smf-exim start'
                timeout_seconds='120' />

            <exec_method
                type='method'
                name='stop'
                exec='/opt/pkg/etc/rc.d/smf-exim stop'
                timeout_seconds='60' />

            <exec_method
                type='method'
                name='refresh'
                exec='/opt/pkg/etc/rc.d/smf-exim refresh'
                timeout_seconds='60' />

            <template>
                <common_name>
                    <loctext xml:lang='C'>
                        exim SMTP mail transfer agent
                    </loctext>
                </common_name>
                <documentation>
                    <manpage title='exim' section='1M'
                        manpath='/opt/pkg/man' />
                </documentation>
            </template>

        </instance>

        <stability value='Unstable' />

</service>

</service_bundle>

svccfg validate smtp-exim.xml

svccfg import smtp-exim.xml

Startup script /opt/pkg/etc/rc.d/smf-exim


# 
name="exim"
exim_flags="-bd -q30m"
pkgdir="/opt/pkg"
config="${pkgdir}/etc/${name}/configure"
pidfile="/var/run/${name}.pid"
#
case "$1" in
'refresh')
                [ -f $pidfile ] && kill -HUP `head -1 $pidfile`
                ;;
'start')
                ${pkgdir}/sbin/${name} $exim_flags
                ;;
'stop')
                [ -f $pidfile ] && kill `head -1 $pidfile`
                ;;
*)
                echo "Usage: $0 { start | stop | refresh }"
                exit 1
                ;;
esac
exit 0

chmod 555 /opt/pkg/etc/rc.d/smf-exim

If this imports successfully, you can use the standard SMF commands to start (svcadm enable exim), stop (svcadm disable exim), and reconfigure (svcadm refresh exim) to control Exim.