Update armbianmonitor (#819)

* Update armbianmonitor

Two proposed changes to 'MonitorMode':

Change 0 [Fix the real-time monitor 'sleep' value so it can be adjusted at runtime] 
line 138: equate 'interval' with $1 (note: in the 'case' routine, $2 == command-line $1)
line 325: change term 1 of the comparator from '$1' to 'interval'

Change 1 [add fixed-line functionality to the real-time monitor]
lines 291,297: retain the 'DisplayHeader' reprint routine for command-line case '-m' (scrolled output) 
lines 326-328: add the overwrite routine for command-line case '-M' (fixed-line output)

* Update armbianmonitor

* Update armbianmonitor
This commit is contained in:
jaskcon 2017-11-08 02:41:27 -05:00 committed by Thomas Kaiser
parent 7051559bcd
commit 1a6041a0b2

View File

@ -135,6 +135,7 @@ ParseOptions() {
;;
m|M)
# monitoring mode
interval=$2
echo -e "Stop monitoring using [ctrl]-[c]"
MonitorMode ${OPTARG}
exit 0
@ -237,7 +238,8 @@ DisplayUsage() {
echo -e " armbianmonitor ${BOLD}-c /path/to/test${NC} performs disk health/performance tests"
echo -e " armbianmonitor ${BOLD}-d${NC} monitors writes to \$device"
echo -e " armbianmonitor ${BOLD}-D${NC} tries to upload debug disk info to improve armbianmonitor"
echo -e " armbianmonitor ${BOLD}-m${NC} provides simple CLI monitoring"
echo -e " armbianmonitor ${BOLD}-m${NC} provides simple CLI monitoring - scrolling output"
echo -e " armbianmonitor ${BOLD}-M${NC} provides simple CLI monitoring - fixed-line output"
echo -e " armbianmonitor ${BOLD}-p${NC} tries to install cpuminer for performance measurements"
echo -e " armbianmonitor ${BOLD}-r${NC} tries to install RPi-Monitor"
echo -e " armbianmonitor ${BOLD}-u${NC} tries to upload armhwinfo.log for support purposes"
@ -287,11 +289,13 @@ MonitorMode() {
echo -e "${DisplayHeader}\c"
Counter=0
while true ; do
let Counter++
if [ ${Counter} -eq 15 ]; then
echo -e "\n${DisplayHeader}\c"
Counter=0
fi
if [ "$c" == "m" ]; then
let Counter++
if [ ${Counter} -eq 15 ]; then
echo -e "\n${DisplayHeader}\c"
Counter=0
fi
fi
LoadAvg=$(cut -f1 -d" " </proc/loadavg)
case ${CPUs} in
biglittle)
@ -319,7 +323,10 @@ MonitorMode() {
[ "X${DCIN}" != "Xn/a" ] && \
(DCINvoltage=$(awk '{printf ("%0.2f",$1/1000000); }' <"${DCIN}") ; echo -e " $(printf "%4s" ${DCINvoltage})V\c")
[ -f /sys/devices/virtual/thermal/cooling_device0/cur_state ] && printf " %d/%d" $(cat /sys/devices/virtual/thermal/cooling_device0/cur_state) $(cat /sys/devices/virtual/thermal/cooling_device0/max_state)
sleep ${1:-5}
sleep ${interval:-5}
if [ "$c" == "M" ]; then
printf "\x1b[1A"
fi
done
} # MonitorMode