Commit a6e07d78 authored by FFS-Roland's avatar FFS-Roland

new Package ffs-watchdog for rebooting hanging nodes.

parent cd7c6371
include $(TOPDIR)/rules.mk
PKG_NAME:=ffs-watchdog
PKG_VERSION:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(GLUONDIR)/include/package.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/ffs-watchdog
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Checking Node running correctly
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/ffs-watchdog/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/ffs-watchdog $(1)/etc/init.d/ffs-watchdog
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) ./files/usr/sbin/ffs-watchdog $(1)/usr/sbin/ffs-watchdog
$(INSTALL_DIR) $(1)/usr/lib/micron.d
$(INSTALL_BIN) ./files/usr/lib/micron.d/ffs-watchdog $(1)/usr/lib/micron.d/ffs-watchdog
endef
$(eval $(call BuildPackage,ffs-watchdog))
#!/bin/sh /etc/rc.common
START=97
start () {
/etc/init.d/micrond enable
/etc/init.d/micrond restart
}
stop() {
true
}
*/5 * * * * /usr/sbin/ffs-watchdog
#!/bin/sh
ME=$(basename $0)
if [ $(ps | grep -c "$ME") -gt 4 ]; then
logger -s -t $ME "started twice"
exit 1
fi
if [ "$(uci get gluon-setup-mode.@setup_mode[0].enabled)" = "0" ]; then
FFS=/tmp/.gw.ffs
NOW=$(date +%s)
if [ -n "$(batctl gwl | grep '=>')" ]; then
echo $NOW >$FFS
logger -t $ME "node is online"
else
if [ -f $FFS ]; then
OFF=$(cat $FFS)
DELTA=$((NOW - OFF))
logger -t $ME "offline for ${DELTA} sec."
if [ $DELTA -gt 1000 ]; then
rm $FFS
reboot
fi
else
echo $NOW >$FFS
fi
fi
fi
#!/bin/sh
/etc/init.d/ffs-watchdog enable
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment