babeld: procd support
note: dependant on openwrt commit 85fabd68, adding support for null arguments.
This commit is contained in:
parent
5aa0ece788
commit
159dc575a6
1 changed files with 10 additions and 18 deletions
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
. $IPKG_INSTROOT/lib/functions/network.sh
|
. $IPKG_INSTROOT/lib/functions/network.sh
|
||||||
|
|
||||||
|
USE_PROCD=1
|
||||||
START=70
|
START=70
|
||||||
|
|
||||||
pidfile='/var/run/babeld.pid'
|
|
||||||
CONFIGFILE='/var/etc/babeld.conf'
|
CONFIGFILE='/var/etc/babeld.conf'
|
||||||
OTHERCONFIGFILE="/etc/babeld.conf"
|
OTHERCONFIGFILE="/etc/babeld.conf"
|
||||||
OTHERCONFIGDIR="/tmp/babeld.d/"
|
OTHERCONFIGDIR="/tmp/babeld.d/"
|
||||||
|
@ -212,7 +212,7 @@ babel_config_cb() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start_service() {
|
||||||
mkdir -p /var/lib
|
mkdir -p /var/lib
|
||||||
mkdir -p /var/etc
|
mkdir -p /var/etc
|
||||||
mkdir -p $OTHERCONFIGDIR
|
mkdir -p $OTHERCONFIGDIR
|
||||||
|
@ -235,26 +235,18 @@ start() {
|
||||||
config_foreach parse_old_global_options general
|
config_foreach parse_old_global_options general
|
||||||
# Parse filters separately, since we know which options we expect
|
# Parse filters separately, since we know which options we expect
|
||||||
config_foreach babel_filter filter
|
config_foreach babel_filter filter
|
||||||
|
procd_open_instance
|
||||||
# Using multiple config files is supported since babeld 1.5.1
|
# Using multiple config files is supported since babeld 1.5.1
|
||||||
/usr/sbin/babeld -D -I "$pidfile" -c "$OTHERCONFIGFILE" -c "$CONFIGFILE"
|
procd_set_param command /usr/sbin/babeld -L /var/log/babeld.log -I "" -c "$OTHERCONFIGFILE" -c "$CONFIGFILE"
|
||||||
# Wait for the pidfile to appear
|
procd_set_param file "$OTHERCONFIGFILE" "$CONFIGFILE"
|
||||||
for i in 1 2
|
procd_set_param respawn
|
||||||
do
|
procd_close_instance
|
||||||
[ -f "$pidfile" ] || sleep 1
|
|
||||||
done
|
|
||||||
[ -f "$pidfile" ] || (echo "Failed to start babeld"; exit 42)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
service_triggers() {
|
||||||
[ -f "$pidfile" ] && kill $(cat $pidfile)
|
procd_add_reload_trigger babeld
|
||||||
# avoid race-condition on restart: wait for
|
|
||||||
# babeld to die for real.
|
|
||||||
[ -f "$pidfile" ] && sleep 1
|
|
||||||
[ -f "$pidfile" ] && sleep 1
|
|
||||||
[ -f "$pidfile" ] && sleep 1
|
|
||||||
[ -f "$pidfile" ] && exit 42
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status() {
|
status() {
|
||||||
[ -f "$pidfile" ] && kill -USR1 $(cat $pidfile)
|
kill -USR1 $(pgrep -P 1 babeld)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue