From 8d1678d7e32b36117da36d7f9d79f82b323f04a8 Mon Sep 17 00:00:00 2001 From: Christof Schulze Date: Tue, 3 May 2016 00:28:16 +0200 Subject: [PATCH] re-add init script after it had been lost in a rebase --- .../files/etc/init.d/gluon-mesh-babel | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 package/gluon-mesh-babel/files/etc/init.d/gluon-mesh-babel diff --git a/package/gluon-mesh-babel/files/etc/init.d/gluon-mesh-babel b/package/gluon-mesh-babel/files/etc/init.d/gluon-mesh-babel new file mode 100644 index 00000000..271ebc41 --- /dev/null +++ b/package/gluon-mesh-babel/files/etc/init.d/gluon-mesh-babel @@ -0,0 +1,38 @@ +#!/bin/sh /etc/rc.common + +. $IPKG_INSTROOT/lib/functions/network.sh + +START=70 + +pidfile='/var/run/babeld.pid' +CONFIGFILE='/var/etc/gluon-babel.conf' +EXTRA_COMMANDS="status" +EXTRA_HELP=" status Dump Babel's table to the log file." + +start() { + mkdir -p /var/lib + mkdir -p /var/etc + + /lib/gluon/gluon-mesh-babel/mkconfig "$CONFIGFILE" + /usr/sbin/babeld -D -I "$pidfile" -c "$CONFIGFILE" + # Wait for the pidfile to appear + for i in 1 2 + do + [ -f "$pidfile" ] || sleep 1 + done + [ -f "$pidfile" ] || (echo "Failed to start babeld"; exit 42) +} + +stop() { + [ -f "$pidfile" ] && kill $(cat $pidfile) + # 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() { + [ -f "$pidfile" ] && kill -USR1 $(cat $pidfile) +}