blob: 04c3a757873f0cf2131d09ea0d4882afc49542a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/bin/sh /etc/rc.common
START=50
BIN=/usr/sbin/olsrd
CONF=/var/etc/olsrd.conf
DEFAULT=/etc/default/olsrd
PID=/var/run/olsrd.pid
start() {
### load defaults
[ -f $DEFAULT ] && . $DEFAULT
### generate config
mkdir -p ${CONF%/*}
lua /lib/config/olsr.lua > $CONF
### check for running instance (start-stop-daemon is too stupid to do this)
if [ -s $PID ]; then
if kill -0 $(cat $PID) 2>&-; then
echo "there is already a running instance ($(cat $PID))"
exit 1
fi
fi
### start olsrd
start-stop-daemon -b -m -p $PID -x $BIN -S -- -f $CONF -nofork $OPTIONS
}
stop() {
### stop olsrd
start-stop-daemon -q -p $PID -a ${BIN##*/} -K
}
restart() {
### override generic restart because we need some time between stop and start
stop; sleep 3; start
}
|