Fix pid writing with olsrd (#1480)
[lede-routing/.git] / files / olsrd.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3
4 BIN=olsrd
5 DEFAULT=/etc/default/olsrd
6 RUN_D=/var/run
7 PID_F=$RUN_D/$BIN.pid
8
9 start() {
10         [ -f $DEFAULT ] && . $DEFAULT
11         $BIN -nofork $OPTIONS &
12         
13         # write pid file (but strip out own pid ($$))
14         mkdir -p $RUN_D
15         PID=`pidof $BIN`
16         echo ${PID%$$} > $PID_F
17
18
19 }
20
21 stop() {
22         killall olsrd
23 }