Message ID | 20200422140527.894934-3-fabian@blaese.de |
---|---|
State | Accepted |
Headers | show |
diff --git a/src/packages/fff/fff-batman-adv/files/usr/lib/nodewatcher.d/30-batman-adv.sh b/src/packages/fff/fff-batman-adv/files/usr/lib/nodewatcher.d/30-batman-adv.sh index 5fe4d89..9639761 100755 --- a/src/packages/fff/fff-batman-adv/files/usr/lib/nodewatcher.d/30-batman-adv.sh +++ b/src/packages/fff/fff-batman-adv/files/usr/lib/nodewatcher.d/30-batman-adv.sh @@ -6,7 +6,7 @@ debug() { (>&2 echo "$1") } -debug "$(date): Collecting information from batman advanced and its interfaces" +debug "Collecting information from batman advanced and its interfaces" if [ -f /sys/module/batman_adv/version ]; then for iface in $(batctl if | sed 's/ //'); do @@ -53,7 +53,7 @@ if [ -f /sys/module/batman_adv/version ]; then echo -n "<batman_adv_gateway_list>$batman_adv_gateway_list</batman_adv_gateway_list>" else - debug "$(date): No batman data .." + debug "No batman data .." exit 1 fi diff --git a/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/20-interfaces.sh b/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/20-interfaces.sh index acb1eee..44d2cea 100755 --- a/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/20-interfaces.sh +++ b/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/20-interfaces.sh @@ -17,7 +17,7 @@ inArray() { return 1 } -debug "$(date): Collecting information from network interfaces" +debug "Collecting information from network interfaces" interface_data="" diff --git a/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/50-clients.sh b/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/50-clients.sh index c4a0a61..aca3db2 100755 --- a/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/50-clients.sh +++ b/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/50-clients.sh @@ -8,7 +8,7 @@ debug() { (>&2 echo "$1") } -debug "$(date): Collecting information about connected clients" +debug "Collecting information about connected clients" client_count=0 dataclient="" diff --git a/src/packages/fff/fff-nodewatcher/files/usr/lib/nodewatcher.d/10-systemdata.sh b/src/packages/fff/fff-nodewatcher/files/usr/lib/nodewatcher.d/10-systemdata.sh index c9a315e..0f495f8 100755 --- a/src/packages/fff/fff-nodewatcher/files/usr/lib/nodewatcher.d/10-systemdata.sh +++ b/src/packages/fff/fff-nodewatcher/files/usr/lib/nodewatcher.d/10-systemdata.sh @@ -9,7 +9,7 @@ debug() { (>&2 echo "$1") } -debug "$(date): Collecting basic system status data" +debug "Collecting basic system status data" SYSTEM_DATA="<status>online</status>" @@ -59,7 +59,7 @@ SYSTEM_DATA="$SYSTEM_DATA<local_time>$(date +%s)</local_time>" load=$(awk '{ printf "<loadavg>"$3"</loadavg><processes>"$4"</processes>" }' /proc/loadavg) SYSTEM_DATA="$SYSTEM_DATA$load" -debug "$(date): Collecting version information" +debug "Collecting version information" SYSTEM_DATA="$SYSTEM_DATA<batman_advanced_version>$(cat /sys/module/batman_adv/version)</batman_advanced_version>" SYSTEM_DATA="$SYSTEM_DATA<kernel_version>$(uname -r)</kernel_version>" @@ -95,7 +95,7 @@ SYSTEM_DATA="$SYSTEM_DATA<firmware_revision>$BUILD_DATE</firmware_revision>" SYSTEM_DATA="$SYSTEM_DATA<openwrt_core_revision>$OPENWRT_CORE_REVISION</openwrt_core_revision>" SYSTEM_DATA="$SYSTEM_DATA<openwrt_feeds_packages_revision>$OPENWRT_FEEDS_PACKAGES_REVISION</openwrt_feeds_packages_revision>" -debug "$(date): Collecting hood information and additional status data" +debug "Collecting hood information and additional status data" SYSTEM_DATA="$SYSTEM_DATA<hood>$(uci -q get "system.@system[0].hood")</hood>" SYSTEM_DATA="$SYSTEM_DATA<hoodid>$(uci -q get "system.@system[0].hoodid")</hoodid>" diff --git a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher index 51b3e9e..8cee7ce 100755 --- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher +++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher @@ -23,7 +23,7 @@ debug() { #This method generates the crawl data XML file that is being fetched by netmon #and provided by a small local httpd crawl() { - debug "$(date): Putting all information into a XML-File and save it at $SCRIPT_DATA_FILE" + debug "Putting all information into a XML-File and save it at $SCRIPT_DATA_FILE" DATA="<?xml version='1.0' standalone='yes'?><data>" @@ -43,7 +43,7 @@ crawl() { LANG=C #Erzeugt die statusdaten -debug "$(date): Generate actual status data" +debug "Generate actual status data" crawl exit 0
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> > -----Original Message----- > From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf > Of Fabian Bläse > Sent: Mittwoch, 22. April 2020 16:05 > To: franken-dev@freifunk.net > Subject: [PATCH v2 3/5] nodewatcher.d: Remove $(date) from debug output > > Debug output is written to stderr now. > Therefore the output is happening in real time and the current date and time > are not necessary anymore. > > Typically the date and time are added by the syslog daemon. > > Signed-off-by: Fabian Bläse <fabian@blaese.de> > --- > Changes in v2: > - Remove $(date) instead of moving it > --- > .../files/usr/lib/nodewatcher.d/30-batman-adv.sh | 4 ++-- > .../files/usr/lib/nodewatcher.d/20-interfaces.sh | 2 +- > .../fff-network/files/usr/lib/nodewatcher.d/50-clients.sh | 2 +- > .../files/usr/lib/nodewatcher.d/10-systemdata.sh | 6 +++--- > src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher | 4 ++-- > 5 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/src/packages/fff/fff-batman-adv/files/usr/lib/nodewatcher.d/30- > batman-adv.sh b/src/packages/fff/fff-batman- > adv/files/usr/lib/nodewatcher.d/30-batman-adv.sh > index 5fe4d89..9639761 100755 > --- a/src/packages/fff/fff-batman-adv/files/usr/lib/nodewatcher.d/30- > batman-adv.sh > +++ b/src/packages/fff/fff-batman-adv/files/usr/lib/nodewatcher.d/30-bat > +++ man-adv.sh > @@ -6,7 +6,7 @@ debug() { > (>&2 echo "$1") > } > > -debug "$(date): Collecting information from batman advanced and its > interfaces" > +debug "Collecting information from batman advanced and its interfaces" > > if [ -f /sys/module/batman_adv/version ]; then > for iface in $(batctl if | sed 's/ //'); do @@ -53,7 +53,7 @@ if [ -f > /sys/module/batman_adv/version ]; then > > echo -n > "<batman_adv_gateway_list>$batman_adv_gateway_list</batman_adv_ga > teway_list>" > else > - debug "$(date): No batman data .." > + debug "No batman data .." > exit 1 > fi > > diff --git a/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/20- > interfaces.sh b/src/packages/fff/fff- > network/files/usr/lib/nodewatcher.d/20-interfaces.sh > index acb1eee..44d2cea 100755 > --- a/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/20- > interfaces.sh > +++ b/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/20-interf > +++ aces.sh > @@ -17,7 +17,7 @@ inArray() { > return 1 > } > > -debug "$(date): Collecting information from network interfaces" > +debug "Collecting information from network interfaces" > > interface_data="" > > diff --git a/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/50- > clients.sh b/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/50- > clients.sh > index c4a0a61..aca3db2 100755 > --- a/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/50-clients.sh > +++ b/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/50-client > +++ s.sh > @@ -8,7 +8,7 @@ debug() { > (>&2 echo "$1") > } > > -debug "$(date): Collecting information about connected clients" > +debug "Collecting information about connected clients" > > client_count=0 > dataclient="" > diff --git a/src/packages/fff/fff- > nodewatcher/files/usr/lib/nodewatcher.d/10-systemdata.sh > b/src/packages/fff/fff-nodewatcher/files/usr/lib/nodewatcher.d/10- > systemdata.sh > index c9a315e..0f495f8 100755 > --- a/src/packages/fff/fff-nodewatcher/files/usr/lib/nodewatcher.d/10- > systemdata.sh > +++ b/src/packages/fff/fff-nodewatcher/files/usr/lib/nodewatcher.d/10-sy > +++ stemdata.sh > @@ -9,7 +9,7 @@ debug() { > (>&2 echo "$1") > } > > -debug "$(date): Collecting basic system status data" > +debug "Collecting basic system status data" > > SYSTEM_DATA="<status>online</status>" > > @@ -59,7 +59,7 @@ SYSTEM_DATA="$SYSTEM_DATA<local_time>$(date > +%s)</local_time>" > load=$(awk '{ printf > "<loadavg>"$3"</loadavg><processes>"$4"</processes>" }' /proc/loadavg) > SYSTEM_DATA="$SYSTEM_DATA$load" > > -debug "$(date): Collecting version information" > +debug "Collecting version information" > > SYSTEM_DATA="$SYSTEM_DATA<batman_advanced_version>$(cat > /sys/module/batman_adv/version)</batman_advanced_version>" > SYSTEM_DATA="$SYSTEM_DATA<kernel_version>$(uname - > r)</kernel_version>" > @@ -95,7 +95,7 @@ > SYSTEM_DATA="$SYSTEM_DATA<firmware_revision>$BUILD_DATE</firmwa > re_revision>" > > SYSTEM_DATA="$SYSTEM_DATA<openwrt_core_revision>$OPENWRT_COR > E_REVISION</openwrt_core_revision>" > > SYSTEM_DATA="$SYSTEM_DATA<openwrt_feeds_packages_revision>$OPE > NWRT_FEEDS_PACKAGES_REVISION</openwrt_feeds_packages_revision>" > > -debug "$(date): Collecting hood information and additional status data" > +debug "Collecting hood information and additional status data" > > SYSTEM_DATA="$SYSTEM_DATA<hood>$(uci -q get > "system.@system[0].hood")</hood>" > SYSTEM_DATA="$SYSTEM_DATA<hoodid>$(uci -q get > "system.@system[0].hoodid")</hoodid>" > diff --git a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher > b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher > index 51b3e9e..8cee7ce 100755 > --- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher > +++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher > @@ -23,7 +23,7 @@ debug() { > #This method generates the crawl data XML file that is being fetched by > netmon #and provided by a small local httpd > crawl() { > - debug "$(date): Putting all information into a XML-File and save it at > $SCRIPT_DATA_FILE" > + debug "Putting all information into a XML-File and save it at > $SCRIPT_DATA_FILE" > > DATA="<?xml version='1.0' standalone='yes'?><data>" > > @@ -43,7 +43,7 @@ crawl() { > LANG=C > > #Erzeugt die statusdaten > -debug "$(date): Generate actual status data" > +debug "Generate actual status data" > crawl > > exit 0 > -- > 2.26.2
Debug output is written to stderr now. Therefore the output is happening in real time and the current date and time are not necessary anymore. Typically the date and time are added by the syslog daemon. Signed-off-by: Fabian Bläse <fabian@blaese.de> --- Changes in v2: - Remove $(date) instead of moving it --- .../files/usr/lib/nodewatcher.d/30-batman-adv.sh | 4 ++-- .../files/usr/lib/nodewatcher.d/20-interfaces.sh | 2 +- .../fff-network/files/usr/lib/nodewatcher.d/50-clients.sh | 2 +- .../files/usr/lib/nodewatcher.d/10-systemdata.sh | 6 +++--- src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-)