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

%config
    diogene87_enable="$openpkg_rc_def"
    diogene87_log_prolog="true"
    diogene87_log_epilog="true"
    diogene87_log_numfiles="10"
    diogene87_log_minsize="1M"
    diogene87_log_complevel="9"

%common
    diogene87_logfile="@l_prefix@/var/diogene87/log/diogene87.log"

%status -u @l_rusr@ -o
    diogene87_usable="unknown"
    diogene87_active="no"
    @l_prefix@/bin/dio87c version >/dev/null 2>&1 && diogene87_active="yes"
    echo "diogene87_enable=\"$diogene87_enable\""
    echo "diogene87_usable=\"$diogene87_usable\""
    echo "diogene87_active=\"$diogene87_active\""

%start -p 100 -u @l_rusr@
    rcService diogene87 enable yes || exit 0
    rcService diogene87 active yes && exit 0
    @l_prefix@/sbin/dio87d -d

%stop -p 900 -u @l_rusr@
    rcService diogene87 enable yes || exit 0
    rcService diogene87 active no  && exit 0
    @l_prefix@/bin/dio87c shutdown
    sleep 2

%restart -p 100 -u @l_rusr@
    rcService diogene87 enable yes || exit 0
    rcService diogene87 active no  && exit 0
    rc diogene87 stop start

%daily -u @l_susr@
    rcService diogene87 enable yes || exit 0
    shtool rotate -f \
        -n ${diogene87_log_numfiles} -s ${diogene87_log_minsize} -d \
        -z ${diogene87_log_complevel} -m 644 -o @l_rusr@ -g @l_rgrp@ \
        -P "${diogene87_log_prolog}" \
        -E "${diogene87_log_epilog} && rc diogene87 reload" \
        $diogene87_logfile

