port lots of init scripts over to rc.common (more to come)
[packages.git] / net / p910nd / files / p910nd.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3
4 DEFAULT=/etc/default/p910nd
5 RUN_D=/var/run
6
7 start() {
8         mkdir -p $RUN_D
9         [ -f $DEFAULT ] && (
10                 while read port options; do
11                         case "$port" in
12                                 ""|\#*) continue;;
13                         esac
14                         p910nd $options $port
15                         if [ $? -ne 0 ]; then
16                                 exit 1
17                         fi
18                 done
19         ) < $DEFAULT
20 }
21
22 stop() {
23         [ -f $DEFAULT ] && (
24                 while read port options; do
25                         case "$port" in
26                                 ""|\#*) continue;l
27                         esac
28                         PID_F=$RUN_D/p910${port}d.pid
29                         [ -f $PID_F ] && kill $(cat $PID_F)
30                 done
31         ) < $DEFAULT
32 }
33