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.
 
 
 
 
 
 

49 lines
1.2 KiB

#!@l_prefix@/bin/openpkg rc
##
## rc.stun -- Run-Commands
##
%config
stun_enable="$openpkg_rc_def"
stun_bind_addr1="127.0.0.1"
stun_bind_addr2="127.0.0.2"
stun_bind_port1="3478"
stun_bind_port2="3479"
%common
stun_pidfile="@l_prefix@/var/stun/stun.pid"
stun_signal () {
[ -f $stun_pidfile ] && kill -$1 `cat $stun_pidfile`
}
%status -u @l_susr@ -o
stun_usable="unknown"
stun_active="no"
rcService stun enable yes && \
stun_signal 0 && stun_active="yes"
echo "stun_enable=\"$stun_enable\""
echo "stun_usable=\"$stun_usable\""
echo "stun_active=\"$stun_active\""
%start -u @l_susr@
rcService stun enable yes || exit 0
rcService stun active yes && exit 0
@l_prefix@/sbin/stund -b \
-h "${stun_bind_addr1}" \
-a "${stun_bind_addr2}" \
-p "${stun_bind_port1}" \
-o "${stun_bind_port2}" \
-P "${stun_pidfile}"
%stop -u @l_susr@
rcService stun enable yes || exit 0
rcService stun active no && exit 0
stun_signal TERM
sleep 2
rm -f $stun_pidfile >/dev/null 2>&1 || true
%restart -u @l_susr@
rcService stun enable yes || exit 0
rcService stun active no && exit 0
rc stun stop start