olsrd: switch to procd
[feed/routing.git] / olsrd / files / olsrd4.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=olsrd
10 CONF=/var/etc/$OLSRD.conf
11 PID=/var/run/olsrd.pid
12
13 start_service() {
14 olsrd_generate_config $OLSRD
15
16 procd_open_instance
17 procd_set_param command "$BIN"
18 procd_append_param command -f ${CONF}
19 procd_append_param command -nofork
20 procd_append_param command -pidfile ${PID}
21
22 # restart if olsrd dies
23 procd_set_param respawn
24
25 # automatically restart olsrd if generated cfg has changed
26 procd_set_param file $CONF
27
28 procd_set_param pidfile $PID
29
30 procd_close_instance
31
32 olsrd_setup_smartgw_rules
33 }
34
35 service_triggers() {
36 # restart on ifup interface events
37 for n in $(olsrd_list_configured_interfaces $OLSRD); do
38 procd_add_reload_interface_trigger $n /etc/init.d/$OLSRD reload
39 done
40 }