From 269c3f356774e3a0032a3bbd88b35d4fb1a1103e Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Sat, 12 Dec 2020 13:57:46 +0100 Subject: [PATCH] add ip address to system_stats Signed-off-by: Michel-FK --- .../funkey/rootfs-overlay/usr/local/sbin/system_stats | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/system_stats b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/system_stats index a6a091a..5464321 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/system_stats +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/system_stats @@ -23,13 +23,18 @@ while true; do cpu=$(printf "%.1f\n" $(mpstat -P ALL $UPDATE_PERIOD 1 | tail -1 | awk '{print 100-$12}')) ram_mem=$(printf "%.1f\n" $(free | grep Mem | awk '{print $3/$2 * 100.0}')) ram_swap=$(printf "%.1f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}')) + ip_addr=$(ifconfig usb0 | grep "inet " | awk -F'[: ]+' '{ print $4 }') # Notif if [ ${notif_dirty} -eq 1 ]; then notif_clear notif_dirty=0 else - notif_set 0 "CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%" + if [ "x${ip_addr}" != "x" ]; then + notif_set 0 "CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%^IP:${ip_addr}" + else + notif_set 0 "CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%" + fi fi else sleep ${UPDATE_PERIOD}