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.
 
 
 
 
 
 

60 lines
1.8 KiB

#!@l_prefix@/bin/openpkg rc
##
## rc.webhook -- Run-Commands
##
%config
webhook_enable="$openpkg_rc_def"
webhook_flags="-ip 127.0.0.1 -port 9000 -verbose"
webhook_log_prolog="true"
webhook_log_epilog="true"
webhook_log_numfiles="10"
webhook_log_minsize="1M"
webhook_log_complevel="9"
%common
webhook_cfgfile="@l_prefix@/etc/webhook/hooks.json"
webhook_pidfile="@l_prefix@/var/webhook/run/webhook.pid"
webhook_logfile="@l_prefix@/var/webhook/log/webhook.log"
webhook_signal () {
[ -f $webhook_pidfile ] && kill -$1 `cat $webhook_pidfile`
}
%status -u @l_rusr@ -o
webhook_usable="unknown"
webhook_active="no"
rcService webhook enable yes && \
webhook_signal 0 && webhook_active="yes"
echo "webhook_enable=\"$webhook_enable\""
echo "webhook_usable=\"$webhook_usable\""
echo "webhook_active=\"$webhook_active\""
%start -u @l_rusr@
rcService webhook enable yes || exit 0
rcService webhook active yes && exit 0
( nohup @l_prefix@/sbin/webhook -hooks "$webhook_cfgfile" $webhook_flags \
</dev/null >>$webhook_logfile 2>&1 &
echo $! >$webhook_pidfile
) >/dev/null 2>&1
%stop -u @l_rusr@
rcService webhook enable yes || exit 0
rcService webhook active no && exit 0
webhook_signal TERM
sleep 2
rm -f $webhook_pidfile >/dev/null 2>&1 || true
%restart -u @l_rusr@
rcService webhook enable yes || exit 0
rcService webhook active no && exit 0
rc webhook stop start
%daily -u @l_rusr@
rcService webhook enable yes || exit 0
shtool rotate -f \
-n ${webhook_log_numfiles} -s ${webhook_log_minsize} -d \
-z ${webhook_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \
-P "${webhook_log_prolog}" \
-E "${webhook_log_epilog}; rc webhook restart" \
$webhook_logfile