olsrd: switch to procd
[feed/routing.git] / olsrd / files / olsrd6.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2008-2013 OpenWrt.org
3
4 . $IPKG_INSTROOT/lib/functions/olsrd.sh
5
6 START=65
7 USE_PROCD=1
8 BIN=/usr/sbin/olsrd
9 OLSRD=olsrd6
10 CONF=/var/etc/$OLSRD.conf
11 PID=/var/run/olsrd6.pid
12
13
14 start_service() {
15 olsrd_generate_config $OLSRD
16
17 procd_open_instance
18 procd_set_param command "$BIN"
19 procd_append_param command -f ${CONF}
20 procd_append_param command -nofork
21 procd_append_param command -pidfile ${PID}
22
23 # restart if olsrd dies
24 procd_set_param respawn
25
26 # automatically restart olsrd if generated cfg has changed
27 procd_set_param file $CONF
28
29 procd_set_param pidfile $PID
30
31 procd_close_instance
32
33 olsrd_setup_smartgw_rules
34 }
35
36 service_triggers() {
37 # restart on ifup interface events
38 for n in $(olsrd_list_configured_interfaces $OLSRD); do
39 procd_add_reload_interface_trigger $n /etc/init.d/$OLSRD reload
40 done
41 }