You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

55 lines
1.6 KiB

#!@l_prefix@/bin/openpkg rc
##
## rc.sendfile -- Run-Commands
##
%config
sendfile_enable="$openpkg_rc_def"
sendfile_bind="127.0.0.1"
sendfile_port="487"
sendfile_flags=""
sendfile_log_prolog="true"
sendfile_log_epilog="true"
sendfile_log_numfiles="10"
sendfile_log_minsize="1M"
sendfile_log_complevel="9"
%common
sendfile_pidfile="@l_prefix@/var/sendfile/run/sendfiled.pid"
sendfile_signal () {
[ -f $sendfile_pidfile ] && kill -$1 `cat $sendfile_pidfile`
}
sendfile_start () {
( @l_prefix@/sbin/sendfiledx ${sendfile_bind}${sendfile_bind:+:}${sendfile_port:-sendfile} \
@l_prefix@/sbin/sendfiled ${sendfile_flags} \
</dev/null >/dev/null 2>&1 &
echo $! >$sendfile_pidfile
) </dev/null >/dev/null 2>&1
}
%status -u @l_susr@ -o
sendfile_usable="no"
sendfile_active="no"
rcService sendfile enable yes && \
sendfile_signal 0 && sendfile_active="yes"
echo "sendfile_enable=\"$sendfile_enable\""
echo "sendfile_usable=\"$sendfile_usable\""
echo "sendfile_active=\"$sendfile_active\""
%start -p 100 -u @l_susr@
rcService sendfile enable yes || exit 0
rcService sendfile active yes && exit 0
sendfile_start
%stop -p 900 -u @l_susr@
rcService sendfile enable yes || exit 0
rcService sendfile active no && exit 0
sendfile_signal TERM
sleep 2
rm -f $sendfile_pidfile 2>/dev/null || true
%restart -p 100 -u @l_susr@
rcService sendfile enable yes || exit 0
rcService sendfile active no && exit 0
rc sendfile stop start