#!@l_prefix@/bin/openpkg rc ## ## rc.tusd -- Run-Commands ## %config tusd_enable="$openpkg_rc_def" tusd_flags="" tusd_log_prolog="true" tusd_log_epilog="true" tusd_log_numfiles="10" tusd_log_minsize="1M" tusd_log_complevel="9" %common tusd_cfgfile="@l_prefix@/etc/tusd/tusd.conf" tusd_pidfile="@l_prefix@/var/tusd/run/tusd.pid" tusd_logfile="@l_prefix@/var/tusd/log/tusd.log" tusd_signal () { [ -f $tusd_pidfile ] && kill -$1 `cat $tusd_pidfile` } %status -u @l_rusr@ -o tusd_usable="unknown" tusd_active="no" rcService tusd enable yes && \ tusd_signal 0 && tusd_active="yes" echo "tusd_enable=\"$tusd_enable\"" echo "tusd_usable=\"$tusd_usable\"" echo "tusd_active=\"$tusd_active\"" %start -u @l_rusr@ rcService tusd enable yes || exit 0 rcService tusd active yes && exit 0 ( nohup @l_prefix@/sbin/tusd \ `sed -e "/^ *#/d" -e '/^ *$/d' -e "s;^;-;" <$tusd_cfgfile | \ sed -e ":a" -e "N" -e '$!ba' -e 's/\n/ /g'` \ >$tusd_logfile 2>&1 & echo $! >$tusd_pidfile ) >/dev/null 2>&1 %stop -u @l_rusr@ rcService tusd enable yes || exit 0 rcService tusd active no && exit 0 tusd_signal TERM sleep 2 rm -f $tusd_pidfile >/dev/null 2>&1 || true %restart -u @l_rusr@ rcService tusd enable yes || exit 0 rcService tusd active no && exit 0 rc tusd stop start %daily -u @l_rusr@ rcService tusd enable yes || exit 0 shtool rotate -f \ -n ${tusd_log_numfiles} -s ${tusd_log_minsize} -d \ -z ${tusd_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \ -P "${tusd_log_prolog}" \ -E "${tusd_log_epilog}; rc tusd restart" \ $tusd_logfile