diff options
author | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-09-17 21:45:30 +0000 |
---|---|---|
committer | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-09-17 21:45:30 +0000 |
commit | 62ff68fba54acba199c9eb4aed7ac912cdfd50cf (patch) | |
tree | fc0c6034daf9bd0276dc91d027e26be26004680b /package/network/services/relayd | |
parent | d0682a9114c910576350e424bbfb8b12e2bd7c4f (diff) |
procd: convert various packages to procd style init.d scripts
Signed-off-by: John Crispin <blogic@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38023 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/network/services/relayd')
-rw-r--r-- | package/network/services/relayd/files/relay.init | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/package/network/services/relayd/files/relay.init b/package/network/services/relayd/files/relay.init index 43ba6e10f4..edc419c0b9 100644 --- a/package/network/services/relayd/files/relay.init +++ b/package/network/services/relayd/files/relay.init @@ -2,9 +2,12 @@ # Copyright (c) 2011-2012 OpenWrt.org START=80 +USE_PROCD=1 +PROG=/usr/sbin/relayd + resolve_ifname() { grep -qs "^ *$1:" /proc/net/dev && { - append args "-I $1" + procd_append_param command -I "$1" append ifaces "$1" } } @@ -37,6 +40,9 @@ start_relay() { fi } + procd_open_instance + procd_set_param command "$PROG" + local net networks config_get networks "$cfg" network for net in $networks; do @@ -53,44 +59,41 @@ start_relay() { local ipaddr config_get ipaddr "$cfg" ipaddr - [ -n "$ipaddr" ] && append args "-L $ipaddr" + [ -n "$ipaddr" ] && procd_append_param command -L "$ipaddr" local gateway config_get gateway "$cfg" gateway - [ -n "$gateway" ] && append args "-G $gateway" + [ -n "$gateway" ] && procd_append_param command -G "$gateway" local expiry # = 30 config_get expiry "$cfg" expiry - [ -n "$expiry" ] && append args "-t $expiry" + [ -n "$expiry" ] && procd_append_param command "$expiry" local retry # = 5 config_get retry "$cfg" retry - [ -n "$retry" ] && append args "-p $retry" + [ -n "$retry" ] && procd_append_param command -p "$retry" local table # = 16800 config_get table "$cfg" table - [ -n "$table" ] && append args "-T $table" + [ -n "$table" ] && procd_append_param command -T "$table" local fwd_bcast # = 1 config_get_bool fwd_bcast "$cfg" forward_bcast 1 - [ $fwd_bcast -eq 1 ] && append args "-B" + [ $fwd_bcast -eq 1 ] && procd_append_param command "-B" local fwd_dhcp # = 1 config_get_bool fwd_dhcp "$cfg" forward_dhcp 1 - [ $fwd_dhcp -eq 1 ] && append args "-D" + [ $fwd_dhcp -eq 1 ] && procd_append_param command"-D" - service_start /usr/sbin/relayd $args + procd_close_instance } -stop() { - for pid in /var/run/relay-*.pid; do - SERVICE_PID_FILE="$pid" - service_stop /usr/sbin/relayd - rm -f "$SERVICE_PID_FILE" - done +service_triggers() +{ + procd_add_reload_trigger "network" } -start() { +start_service() { include /lib/network config_load network config_foreach start_relay interface |