Sysadmin > SolarIs > SmfManifests > PostgreySmfManifest

postgrey manifest

postgrey manifest =/var/svc/manifest/network/postgrey.xml

<?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:postgrey'>

<service
        name='network/greylisting'
        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='postgrey' enabled='false'>

            <dependency
                name='config-file'
                grouping='require_all'
                restart_on='refresh'
                type='path'>
                    <service_fmri value='file://localhost/var/db/postgrey/postgrey.db' />
            </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-postgrey_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-postgrey start'
                timeout_seconds='60' />

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

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

            <template>
                <common_name>
                    <loctext xml:lang='C'>
                        postgrey mail greylisting service
                    </loctext>
                </common_name>
                <documentation>
                    <manpage title='postgrey' section='1M'
                        manpath='/opt/pkg/man' />
                </documentation>
            </template>

        </instance>

        <stability value='Unstable' />

</service>

</service_bundle>

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


# 
name="postgrey"
pidfile="/var/run/${name}.pid"
postgrey_flags="--exim --user=postgrey --unix=/var/run/postgrey.sock -d --pidfile=${pidfile}"
pkgdir="/opt/pkg"
#
case "$1" in
'refresh')
                [ -f $pidfile ] && kill -HUP `head -1 $pidfile`
                ;;
'start')
                ${pkgdir}/sbin/${name} $postgrey_flags
                ;;
'stop')
                [ -f $pidfile ] && kill `head -1 $pidfile`
                ;;
*)
                echo "Usage: $0 { start | stop | refresh }"
                exit 1
                ;;
esac