#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
##
##  rc.postfix -- Run-Commands for Postfix Daemon
##

%config
    mta_name="exim"
    mta_aliases_file="@l_prefix@/etc/exim/aliases"
    mta_aliases_update="true"
    exim_enable="yes"
    exim_flags="-bd -q30m"

%start -p 200 -u root
    opServiceEnabled exim || exit 0
    @l_prefix@/sbin/exim ${exim_flags}

%stop -p 200 -u root
    opServiceEnabled exim || exit 0
    for pidfile in @l_prefix@/var/exim/run/*.pid; do
        [ ".$pidfile" = ".@l_prefix@/var/exim/run/*.pid" ] && break
        kill -TERM `cat $pidfile`
    done

%restart -u root
    opServiceEnabled exim || exit 0
    for pidfile in @l_prefix@/var/exim/run/*.pid; do
        [ ".$pidfile" = ".@l_prefix@/var/exim/run/*.pid" ] && break
        kill -TERM `cat $pidfile`
    done
    sleep 1
    @l_prefix@/sbin/exim ${exim_flags}

%reload -u root
    opServiceEnabled exim || exit 0
    for pidfile in @l_prefix@/var/exim/run/*.pid; do
        [ ".$pidfile" = ".@l_prefix@/var/exim/run/*.pid" ] && break
        kill -HUP `cat $pidfile`
    done

%daily -u root
    opServiceEnabled exim || exit 0

