#!/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 }