packages/net/stun/files/stund.init
jow 0f00e69aef [packages] stun: fix init script (#9528)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@27141 3c298f89-4303-0410-b956-a3cf2f4a3e73
2011-06-09 00:34:46 +00:00

29 lines
632 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2009-2011 OpenWrt.org
START=70
start() {
local pri_ip sec_ip pri_port sec_port
parse_opts() {
local cfg="$1"
config_get pri_ip "$cfg" primaryip
config_get sec_ip "$cfg" secondaryip
config_get pri_port "$cfg" primaryport
config_get sec_port "$cfg" secondaryport
}
config_load "stund"
config_foreach parse_opts
start-stop-daemon -S -p /var/run/stund.pid -m -b \
-x /usr/sbin/stund -- \
${pri_ip:+-h $pri_ip} ${sec_ip:+-a $sec_ip} \
${pri_port:+-p $pri_port} ${sec_port:+-o $sec_port}
}
stop() {
service_kill stund /var/run/stund.pid
rm -f /var/run/stund.pid
}