6
6
# Addresses Issue 5: https://github.com/jpmck/chronometer2/issues/5 ... I think...
7
7
export LC_ALL=C.UTF-8
8
8
9
- chronometer2Version=" 1.2.1 "
9
+ chronometer2Version=" 1.2.2 "
10
10
11
11
# COLORS
12
12
blueColor=$( tput setaf 6)
@@ -87,7 +87,9 @@ GetSystemInformation() {
87
87
cpuPercent=$( printf %.1f " $( echo " scale=4; (${cpuLoad1} /${numProc} )*100" | bc) " )
88
88
89
89
# Memory use
90
- memoryUsedPercent=$( free | awk ' /Mem/ {printf "%.1f",($2-$4-$6-$7)/$2 * 100}' )
90
+ # Corrects Issue #9 https://github.com/jpmck/chronometer2/issues/9
91
+ # Thanks, Twiggy159 and WaLLy3K!
92
+ memoryUsedPercent=$( awk ' /MemTotal:/{total=$2} /MemFree:/{free=$2} /Buffers:/{buffers=$2} /^Cached:/{cached=$2} END {printf "%.1f", (total-free-buffers-cached)*100/total}' ' /proc/meminfo' )
91
93
92
94
# CPU temperature heatmap
93
95
if [ ${cpu} -gt 60000 ]; then
@@ -365,6 +367,7 @@ normalChrono() {
365
367
GetNetworkInformation
366
368
GetVersionInformation
367
369
370
+
368
371
sleep 5
369
372
done
370
373
}
384
387
}
385
388
386
389
if [[ $# = 0 ]]; then
390
+
391
+ # Turns off the cursor
392
+ # (From Pull request #8 https://github.com/jpmck/chronometer2/pull/8)
393
+ setterm -cursor off
394
+ trap " { setterm -cursor on ; echo " " ; exit 0 ; }" SIGINT SIGTERM EXIT
395
+
387
396
clear
388
397
389
398
# Nice logo
@@ -395,7 +404,14 @@ if [[ $# = 0 ]]; then
395
404
# Get Our Config Values
396
405
. /etc/pihole/setupVars.conf
397
406
398
- echo " START UP===================================================="
407
+ echo " START UP ==================================================="
408
+
409
+ # Get PID of Chronometer2
410
+ pid=$( echo $$ )
411
+ echo " - Writing PID (${pid} ) to file..."
412
+ echo ${pid} > ./chronometer2.pid
413
+
414
+ # Check for updates
399
415
echo " - Checking for Chronometer2 version file..."
400
416
if [ -e " piHoleVersion" ]; then
401
417
echo " - Chronometer2 version file found... deleting."
0 commit comments