From f6e950ffc269f6669a9f642f9f9418647139f114 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Sat, 14 Sep 2024 22:09:00 +0200 Subject: [PATCH] MOTD: fix error when traffic info is enabled --- .../common/etc/update-motd.d/30-armbian-sysinfo | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/bsp/common/etc/update-motd.d/30-armbian-sysinfo b/packages/bsp/common/etc/update-motd.d/30-armbian-sysinfo index 2b52bcf7b58a..38a8debe12d2 100755 --- a/packages/bsp/common/etc/update-motd.d/30-armbian-sysinfo +++ b/packages/bsp/common/etc/update-motd.d/30-armbian-sysinfo @@ -172,24 +172,24 @@ display "Battery" "$battery_percent" "20" "1" "%" "$status_battery_text" ; a=$(( line=0 if [[ -n "$PRIMARY_INTERFACE" ]] && vnstat -i "$PRIMARY_INTERFACE" &> /dev/null; then - traffic=$(vnstat -i $PRIMARY_INTERFACE --oneline | cut -d";" -f4,5) - traffic_rx=$(echo $traffic | cut -d";" -f1,1 | sed -r 's/([0-9]+\.[0-9]{1})[0-9]*/\1/' | cut -d" " -f1 | cut -d"," -f1) + traffic=$(LC_ALL=C vnstat -i $PRIMARY_INTERFACE --oneline | cut -d";" -f4,5) + traffic_rx=$(echo $traffic | cut -d";" -f1,1 | sed -r 's/([0-9]+\.[0-9]{1})[0-9]*/\1/' | cut -d" " -f1 | cut -d"." -f1) traffic_rx_unit=$(echo $traffic | cut -d";" -f1,1 | sed -r 's/([0-9]+\.[0-9]{1})[0-9]*/\1/' | cut -d" " -f2) - traffic_tx=$(echo $traffic | cut -d";" -f2,2 | sed -r 's/([0-9]+\.[0-9]{1})[0-9]*/\1/' | cut -d" " -f1 | cut -d"," -f1) + traffic_tx=$(echo $traffic | cut -d";" -f2,2 | sed -r 's/([0-9]+\.[0-9]{1})[0-9]*/\1/' | cut -d" " -f1 | cut -d"." -f1) traffic_tx_unit=$(echo $traffic | cut -d";" -f2,2 | sed -r 's/([0-9]+\.[0-9]{1})[0-9]*/\1/' | cut -d" " -f2) [[ "$traffic" == *"Not enough"* ]] && { traffic_tx="n/a "; traffic_rx="n/a "; } case $PRIMARY_DIRECTION in tx) - display " TX today" "$traffic_tx" 500 0 " $traffic_tx_unit" "" + display " TX today" "$traffic_tx" 500 0 "" "$traffic_tx_unit" "" line=$((line+1)) ;; rx) - display " RX today" "$traffic_rx" 500 0 " $traffic_rx_unit" "" + display " RX today" "$traffic_rx" 500 0 "" "$traffic_rx_unit" "" line=$((line+1)) ;; both) - display " TX today" "$traffic_tx" 500 0 " $traffic_tx_unit" "" - display "RX today" "$traffic_rx" 500 0 " $traffic_rx_unit" "" + display " TX today" "$traffic_tx" 500 0 "" "$traffic_tx_unit" "" + display "RX today" "$traffic_rx" 500 0 "" "$traffic_rx_unit" "" line=$((line+1)) ;; *) #off or whatever