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.
63 lines
2.3 KiB
63 lines
2.3 KiB
6 years ago
|
#!@l_prefix@/bin/openpkg rc
|
||
|
##
|
||
|
## rc.nats-websocket-gw -- Run-Commands
|
||
|
##
|
||
|
|
||
|
%config
|
||
|
nats_websocket_gw_enable="$openpkg_rc_def"
|
||
|
nats_websocket_gw_flags="--host 127.0.0.1 --port 8080 --path /nats --nats 127.0.0.1:4242"
|
||
|
nats_websocket_gw_log_prolog="true"
|
||
|
nats_websocket_gw_log_epilog="true"
|
||
|
nats_websocket_gw_log_numfiles="10"
|
||
|
nats_websocket_gw_log_minsize="1M"
|
||
|
nats_websocket_gw_log_complevel="9"
|
||
|
|
||
|
%common
|
||
|
nats_websocket_gw_pidfile="@l_prefix@/var/nats-websocket_gw/run/nats-websocket-gw.pid"
|
||
|
nats_websocket_gw_logfile="@l_prefix@/var/nats-websocket_gw/log/nats-websocket-gw.log"
|
||
|
nats_websocket_gw_signal () {
|
||
|
[ -f $nats_websocket_gw_pidfile ] && kill -$1 `cat $nats_websocket_gw_pidfile`
|
||
|
}
|
||
|
|
||
|
%status -u @l_rusr@ -o
|
||
|
nats_websocket_gw_usable="unknown"
|
||
|
nats_websocket_gw_active="no"
|
||
|
rcService nats-websocket-gw enable yes && \
|
||
|
nats_websocket_gw_signal 0 && nats_websocket_gw_active="yes"
|
||
|
echo "nats_websocket_gw_enable=\"$nats_websocket_gw_enable\""
|
||
|
echo "nats_websocket_gw_usable=\"$nats_websocket_gw_usable\""
|
||
|
echo "nats_websocket_gw_active=\"$nats_websocket_gw_active\""
|
||
|
|
||
|
%start -u @l_rusr@
|
||
|
rcService nats-websocket-gw enable yes || exit 0
|
||
|
rcService nats-websocket-gw active yes && exit 0
|
||
|
( GOMAXPROCS=32
|
||
|
export GOMAXPROCS
|
||
|
nohup @l_prefix@/sbin/nats-websocket-gw \
|
||
|
$nats_websocket_gw_flags \
|
||
|
</dev/null >>$nats_websocket_gw_logfile 2>&1 &
|
||
|
echo $! >$nats_websocket_gw_pidfile
|
||
|
) >/dev/null 2>&1
|
||
|
|
||
|
%stop -u @l_rusr@
|
||
|
rcService nats-websocket-gw enable yes || exit 0
|
||
|
rcService nats-websocket-gw active no && exit 0
|
||
|
nats_websocket_gw_signal TERM
|
||
|
sleep 2
|
||
|
rm -f $nats_websocket_gw_pidfile >/dev/null 2>&1 || true
|
||
|
|
||
|
%restart -u @l_rusr@
|
||
|
rcService nats-websocket-gw enable yes || exit 0
|
||
|
rcService nats-websocket-gw active no && exit 0
|
||
|
rc nats-websocket-gw stop start
|
||
|
|
||
|
%daily -u @l_rusr@
|
||
|
rcService nats-websocket-gw enable yes || exit 0
|
||
|
shtool rotate -f \
|
||
|
-n ${nats_websocket_gw_log_numfiles} -s ${nats_websocket_gw_log_minsize} -d \
|
||
|
-z ${nats_websocket_gw_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \
|
||
|
-P "${nats_websocket_gw_log_prolog}" \
|
||
|
-E "${nats_websocket_gw_log_epilog}; rc nats-websocket_gw restart" \
|
||
|
$nats_websocket_gw_logfile
|
||
|
|