From ff6e92b7b1a2e07c6c17066dbc5b09905e87f7c1 Mon Sep 17 00:00:00 2001 From: Dominik Heidler Date: Thu, 10 Dec 2015 16:17:14 +0100 Subject: [PATCH] add mechanism for announcing usergen status txt Signed-off-by: Dominik Heidler Reviewed-by: Tim Niemeyer --- bsp/default/root_file_system/etc/config/nodewatcher | 1 + bsp/default/root_file_system/etc/nodewatcher.sh | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bsp/default/root_file_system/etc/config/nodewatcher b/bsp/default/root_file_system/etc/config/nodewatcher index b830388a..9f308be5 100644 --- a/bsp/default/root_file_system/etc/config/nodewatcher +++ b/bsp/default/root_file_system/etc/config/nodewatcher @@ -2,6 +2,7 @@ config 'script' option 'error_level' '0' option 'logfile' '/var/log/nodewatcher.log' option 'data_file' '/tmp/crawldata/node.data' + option 'status_text_file' '/tmp/status.txt' config 'network' option 'mesh_interface' 'br-mesh' diff --git a/bsp/default/root_file_system/etc/nodewatcher.sh b/bsp/default/root_file_system/etc/nodewatcher.sh index c1f57527..3e7e8364 100755 --- a/bsp/default/root_file_system/etc/nodewatcher.sh +++ b/bsp/default/root_file_system/etc/nodewatcher.sh @@ -16,6 +16,7 @@ if [ -f /etc/config/nodewatcher ];then CLIENT_INTERFACES=`uci get nodewatcher.@network[0].client_interfaces` IFACEBLACKLIST=`uci get nodewatcher.@network[0].iface_blacklist` IPWHITELIST=`uci get nodewatcher.@network[0].ip_whitelist` + SCRIPT_STATUS_FILE=`uci get nodewatcher.@script[0].status_text_file` else . `dirname $0`/nodewatcher_config fi @@ -79,6 +80,10 @@ crawl() { fastd_version=$(fastd -v | awk '{ print $2 }') nodewatcher_version=$SCRIPT_VERSION + if [ -f "$SCRIPT_STATUS_FILE" ]; then + status_text="$(cat "$SCRIPT_STATUS_FILE")" + fi + # example for /etc/openwrt_release: #DISTRIB_ID="OpenWrt" #DISTRIB_RELEASE="Attitude Adjustment" @@ -96,7 +101,7 @@ crawl() { #OPENWRT_CORE_REVISION="35298" #OPENWRT_FEEDS_PACKAGES_REVISION="35298" . /etc/firmware_release - SYSTEM_DATA="online$hostname$distname$distversion$cpu$model$memory$load$uptime$local_time$batman_adv_version$kernel_version$fastd_version$nodewatcher_version$FIRMWARE_VERSION$FIRMWARE_COMMUNITY$BUILD_DATE$OPENWRT_CORE_REVISION$OPENWRT_FEEDS_PACKAGES_REVISION" + SYSTEM_DATA="online$status_text$hostname$distname$distversion$cpu$model$memory$load$uptime$local_time$batman_adv_version$kernel_version$fastd_version$nodewatcher_version$FIRMWARE_VERSION$FIRMWARE_COMMUNITY$BUILD_DATE$OPENWRT_CORE_REVISION$OPENWRT_FEEDS_PACKAGES_REVISION" err "`date`: Collecting information from network interfaces"