1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/stun/rc.stun Fri Jan 09 00:45:56 2009 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +#!@l_prefix@/bin/openpkg rc 1.5 +## 1.6 +## rc.stun -- Run-Commands 1.7 +## 1.8 + 1.9 +%config 1.10 + stun_enable="$openpkg_rc_def" 1.11 + stun_bind_addr1="127.0.0.1" 1.12 + stun_bind_addr2="127.0.0.2" 1.13 + stun_bind_port1="3478" 1.14 + stun_bind_port2="3479" 1.15 + 1.16 +%common 1.17 + stun_pidfile="@l_prefix@/var/stun/stun.pid" 1.18 + stun_signal () { 1.19 + [ -f $stun_pidfile ] && kill -$1 `cat $stun_pidfile` 1.20 + } 1.21 + 1.22 +%status -u @l_susr@ -o 1.23 + stun_usable="unknown" 1.24 + stun_active="no" 1.25 + rcService stun enable yes && \ 1.26 + stun_signal 0 && stun_active="yes" 1.27 + echo "stun_enable=\"$stun_enable\"" 1.28 + echo "stun_usable=\"$stun_usable\"" 1.29 + echo "stun_active=\"$stun_active\"" 1.30 + 1.31 +%start -u @l_susr@ 1.32 + rcService stun enable yes || exit 0 1.33 + rcService stun active yes && exit 0 1.34 + @l_prefix@/sbin/stund -b \ 1.35 + -h "${stun_bind_addr1}" \ 1.36 + -a "${stun_bind_addr2}" \ 1.37 + -p "${stun_bind_port1}" \ 1.38 + -o "${stun_bind_port2}" \ 1.39 + -P "${stun_pidfile}" 1.40 + 1.41 +%stop -u @l_susr@ 1.42 + rcService stun enable yes || exit 0 1.43 + rcService stun active no && exit 0 1.44 + stun_signal TERM 1.45 + sleep 2 1.46 + rm -f $stun_pidfile >/dev/null 2>&1 || true 1.47 + 1.48 +%restart -u @l_susr@ 1.49 + rcService stun enable yes || exit 0 1.50 + rcService stun active no && exit 0 1.51 + rc stun stop start 1.52 +