p910nd fixes:
[openwrt/svn-archive/archive.git] / net / p910nd / files / p910nd.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2007 OpenWrt.org
3 START=50
4
5 BIN=p910nd
6
7 start_service() {
8 local section="$1"
9 config_get port "$section" port
10 config_get device "$section" device
11 config_get_bool bidirectional "$section" bidirectional
12
13 options=""
14 [ $bidirectional -eq 1 ] && {
15 options="$options -b"
16 }
17 options="$options -f $device $port"
18
19 $BIN $options
20 }
21
22 stop_service() {
23 local section="$1"
24 config_get port "$section" port
25
26 PID_F=/var/run/p910${port}d.pid
27 [ -f $PID_F ] && kill $(cat $PID_F)
28 }
29
30 start() {
31 config_load "p910nd"
32 config_foreach start_service p910nd
33 }
34
35 stop() {
36 config_load "p910nd"
37 config_foreach stop_service p910nd
38 }