diff options
Diffstat (limited to 'applications/luci-olsr/root/etc/init.d/olsrd')
-rwxr-xr-x | applications/luci-olsr/root/etc/init.d/olsrd | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/applications/luci-olsr/root/etc/init.d/olsrd b/applications/luci-olsr/root/etc/init.d/olsrd new file mode 100755 index 0000000000..04c3a75787 --- /dev/null +++ b/applications/luci-olsr/root/etc/init.d/olsrd @@ -0,0 +1,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 +} |