Compare commits

..

1 Commits

Author SHA1 Message Date
21a88edfaa Add system-info Linux systemd user unit
Update the `system-info` directory with the addition of a `systemd`
service file and an new Linux script to display current CPU temperature
and core/thread utilization. Update `.conduit.yaml` with addition
`apt` dependencies `sysstat` and `jq`. Update the install and remove
scripts to setup and tear down the `systemd` user unit. Lastly, decrease
the `tmux` status line update interval from 5 to 2 seconds.
2021-02-17 18:54:29 +00:00

View File

@ -9,7 +9,8 @@ if [ ! -d $cache_dir ]; then
fi
# Cleanup cache file when interrupted.
trap '[ -f $cache_file ] && rm $cache_file;' INT
trap '[ -f $cache_file ] && rm $cache_file; exit' INT
trap '[ -f $cache_file ] && rm $cache_file; exit' TERM
while true; do
# Parse the current CPU load on all cores/threads.
@ -17,8 +18,7 @@ while true; do
jq '.sysstat.hosts[0].statistics[0]["cpu-load"][1:]|.[].idle' | \
awk '$idle ~ /[-.0-9]*/ { printf "%s", substr("█▇▆▅▄▃▂▁ ", int($idle / 11), 1) }'`
# Parse the current CPU package temperature.
cpu_temp=`sensors coretemp-isa-0000 | head -3 | tail -1 | \
awk '{ print substr($4, 2) }'`
cpu_temp=`sensors coretemp-isa-0000 | awk 'NR == 3 { print substr($4, 2) }'`
# Write to the cache file.
echo "$cpu_temp $cpu_load" > $cache_file
done