From 625ace106cda0decc60971b60f24d8a18af3cd4c Mon Sep 17 00:00:00 2001 From: root Date: Thu, 13 Jan 2022 12:03:05 +0100 Subject: [PATCH] Replaced swap by battery measurement in system stats --- .../funkey/rootfs-overlay/usr/local/sbin/system_stats | 7 ++++--- .../funkey/rootfs-overlay/usr/local/sbin/system_stats | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) 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 c4e3eb5..3f97949 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/system_stats +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/system_stats @@ -40,7 +40,8 @@ while true; do # Compute stats cpu=$(printf "%.0f\n" $(mpstat -P ALL $UPDATE_PERIOD 1 | tail -1 | awk '{print 100-$12}')) ram_mem=$(printf "%.0f\n" $(free | grep Mem | awk '{print $3/$2 * 100.0}')) - ram_swap=$(printf "%.0f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}')) + #ram_swap=$(printf "%.0f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}')) + battery=$(printf "%.0f\n" $(cat /tmp/current_battery_percentage)) ip_addr=$(ifconfig usb0 | grep "inet " | awk -F'[: ]+' '{ print $4 }') # Notif @@ -49,9 +50,9 @@ while true; do notif_dirty=0 else if [ "x${ip_addr}" != "x" ]; then - notif set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%^IP:${ip_addr}" + notif set 0 " CPU:${cpu}%% RAM:${ram_mem}%% BATTERY:${battery}%%^IP:${ip_addr}" else - notif set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%" + notif set 0 " CPU:${cpu}%% RAM:${ram_mem}%% BATTERY:${battery}%%" fi fi else diff --git a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/system_stats b/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/system_stats index c4e3eb5..3f97949 100755 --- a/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/system_stats +++ b/Recovery/board/funkey/rootfs-overlay/usr/local/sbin/system_stats @@ -40,7 +40,8 @@ while true; do # Compute stats cpu=$(printf "%.0f\n" $(mpstat -P ALL $UPDATE_PERIOD 1 | tail -1 | awk '{print 100-$12}')) ram_mem=$(printf "%.0f\n" $(free | grep Mem | awk '{print $3/$2 * 100.0}')) - ram_swap=$(printf "%.0f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}')) + #ram_swap=$(printf "%.0f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}')) + battery=$(printf "%.0f\n" $(cat /tmp/current_battery_percentage)) ip_addr=$(ifconfig usb0 | grep "inet " | awk -F'[: ]+' '{ print $4 }') # Notif @@ -49,9 +50,9 @@ while true; do notif_dirty=0 else if [ "x${ip_addr}" != "x" ]; then - notif set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%^IP:${ip_addr}" + notif set 0 " CPU:${cpu}%% RAM:${ram_mem}%% BATTERY:${battery}%%^IP:${ip_addr}" else - notif set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%" + notif set 0 " CPU:${cpu}%% RAM:${ram_mem}%% BATTERY:${battery}%%" fi fi else