#!@l_prefix@/bin/openpkg rc
##
##  rc.mailman -- Run-Commands
##

%config
    mailman_enable="$openpkg_rc_def"

%common
    mailman_ctl="@l_prefix@/libexec/mailman/bin/mailmanctl"

%status -u @l_susr@ -o
    mailman_usable="unknown"
    mailman_active="no"
    rcService mailman enable yes && \
        @l_prefix@/bin/python ${mailman_ctl} -q FIXME && \
        mailman_active="yes"
    echo "mailman_enable=\"$mailman_enable\""
    echo "mailman_usable=\"$mailman_usable\""
    echo "mailman_active=\"$mailman_active\""

%start -u @l_susr@
    rcService mailman enable yes || exit 0
    rcService mailman active yes && exit 0
    @l_prefix@/bin/python ${mailman_ctl} -s -q start

%stop -u @l_susr@
    rcService mailman enable yes || exit 0
    rcService mailman active no  && exit 0
    @l_prefix@/bin/python ${mailman_ctl} -q stop
    sleep 2

%restart -u @l_susr@
    rcService mailman enable yes || exit 0
    rcService mailman active no  && exit 0
    @l_prefix@/bin/python ${mailman_ctl} -q restart
    sleep 2

%quarterly -u @l_susr@
    rcService mailman enable yes || exit 0
    @l_prefix@/bin/python -S @l_prefix@/libexec/mailman/cron/gate_news

%daily -u @l_susr@
    rcService mailman enable yes || exit 0
    @l_prefix@/bin/python -S @l_prefix@/libexec/mailman/cron/checkdbs
    @l_prefix@/bin/python -S @l_prefix@/libexec/mailman/cron/disabled
    @l_prefix@/bin/python -S @l_prefix@/libexec/mailman/cron/senddigests
    @l_prefix@/bin/python -S @l_prefix@/libexec/mailman/cron/nightly_gzip

%monthly -u @l_susr@
    rcService mailman enable yes || exit 0
    @l_prefix@/bin/python -S @l_prefix@/libexec/mailman/cron/mailpasswds

