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

%config
    sudosh_enable="$openpkg_rc_def"
    sudosh_session_expire="14d"
    sudosh_log_prolog="true"
    sudosh_log_epilog="true"
    sudosh_log_numfiles="10"
    sudosh_log_minsize="1M"
    sudosh_log_complevel="9"

%common
    sudosh_session_dir="@l_prefix@/var/sudosh/session"
    sudosh_logfile="@l_prefix@/var/sudosh/sudosh.log"

%status -u @l_susr@ -o
    sudosh_usable="yes"
    sudosh_active="no"
    echo "sudosh_enable=\"$sudosh_enable\""
    echo "sudosh_usable=\"$sudosh_usable\""
    echo "sudosh_active=\"$sudosh_active\""

%daily -u @l_susr@
    rcService sudosh enable yes || exit 0
    find $sudosh_session_dir \
        -type f -mtime "+$sudosh_session_expire" -print |\
        xargs rm -f >/dev/null 2>&1 || true
    shtool rotate -f \
        -n $sudosh_log_numfiles -s $sudosh_log_minsize -d \
        -z $sudosh_log_complevel -m 664 -o @l_susr@ -g @l_mgrp@ \
        -P "$sudosh_log_prolog" \
        -E "$sudosh_log_epilog" \
        $sudosh_logfile

