41 lines
845 B
Bash
41 lines
845 B
Bash
#!/bin/sh /etc/rc.common
|
|
# Copyright (C) 2008-2013 OpenWrt.org
|
|
|
|
. $IPKG_INSTROOT/lib/functions/olsrd.sh
|
|
|
|
START=65
|
|
USE_PROCD=1
|
|
BIN=/usr/sbin/olsrd
|
|
OLSRD=olsrd6
|
|
CONF=/var/etc/$OLSRD.conf
|
|
PID=/var/run/olsrd6.pid
|
|
|
|
|
|
start_service() {
|
|
olsrd_generate_config $OLSRD
|
|
|
|
procd_open_instance
|
|
procd_set_param command "$BIN"
|
|
procd_append_param command -f ${CONF}
|
|
procd_append_param command -nofork
|
|
procd_append_param command -pidfile ${PID}
|
|
|
|
# restart if olsrd dies
|
|
procd_set_param respawn
|
|
|
|
# automatically restart olsrd if generated cfg has changed
|
|
procd_set_param file $CONF
|
|
|
|
procd_set_param pidfile $PID
|
|
|
|
procd_close_instance
|
|
|
|
olsrd_setup_smartgw_rules
|
|
}
|
|
|
|
service_triggers() {
|
|
# restart on ifup interface events
|
|
for n in $(olsrd_list_configured_interfaces $OLSRD); do
|
|
procd_add_reload_interface_trigger $n /etc/init.d/$OLSRD reload
|
|
done
|
|
}
|