-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats_curse.sh
executable file
·105 lines (96 loc) · 3.43 KB
/
stats_curse.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/sh
# --------------------------------------------------------------------------
#
# Curse script based on Bash Simple Curses lib, to monitor specific system information,
# like date, local weather and temperature sensors.
# Usage: ./stats_curse.sh
#
# Bash Simple Curses: https://github.com/metal3d/bashsimplecurses
#
# Author: Aggelos Stamatiou, July 2022
#
# This source code is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this source code. If not, see <http://www.gnu.org/licenses/>.
# --------------------------------------------------------------------------
# Bash Simple curses lib import
. `dirname $0`/bashsimplecurses/simple_curses.sh
# Weather script configuration
lat={YOUR_LATITUDE}
long={YOUR_LONGITUDE}
# Initialize weather info
weather=$(./weather.sh $lat $long)
# Auxilary function to refresh weather information.
# Since main loop executes every 2 seconds,
# weather info is refreshed every hour(1800 = 0.5hr).
count=0
refresh_weather() {
if [ $count -gt 1800 ]; then
weather=$(./weather.sh $lat $long)
count=0
fi
count=$(($count+1))
}
# Monitors curse window
main() {
# Basic information
window "$USER@$HOSTNAME" "cyan"
append "`date +"%H:%M"`"
append "`date +"%A %d %B %Y"`"
refresh_weather
append "$weather"
endwin
# CPU temperatures
window "CPU Temperatures" "red"
# Use the corresponding script for the CPU manufacturer
# AMD
#cpu_dies=0
#cpu_temps=($(./amd_cpu.sh $cpu_dies k10temp-pci-00c3))
#append_tabbed "Temperature:${cpu_temps[0]}" 2
#for ((i=0; i<$cpu_dies; i+=1))
#do
# append_tabbed "Die $i:${cpu_temps[$i+1]}" 2
#done
# Intel
#cpu_cores=4
#cpu_temps=($(./intel_cpu.sh $cpu_cores coretemp-isa-0000))
#append_tabbed "Package:${cpu_temps[0]}" 2
#for ((i=0; i<$cpu_cores; i+=1))
#do
# append_tabbed "Core $i:${cpu_temps[$i+1]}" 2
#done
endwin
# GPU information
window "GPU Information" "red"
# Use the corresponding script for the GPU manufacturer
# AMD
#gpu_info=($(./amd_gpu.sh {sensors chip id}))
#append_tabbed "Edge Temperature:${gpu_info[0]}" 2
#append_tabbed "Junction Temperature:${gpu_info[1]}" 2
#append_tabbed "Memory Temperature:${gpu_info[2]}" 2
#append_tabbed "Consuption (PPT):${gpu_info[3]}" 2
# NVIDIA
#gpu_info=($(./nvidia_gpu.sh {GPU index}))
#append_tabbed "Core Temperature:${gpu_info[0]}" 2
endwin
# Disks temperatures
window "Disks temperatures" "red"
# Add one line for each disk, using the corresponding script for its type.
# NVMe example: append_tabbed "Disk name:$(./nvme.sh {sensors chip id})" 2
# SATA example: append_tabbed "Disk name:$(./sata.sh {Disk_Name_Serial})" 2
#append_tabbed "NVMe:$(./nvme.sh {sensors chip id})" 2
#append_tabbed "SSD:$(./sata.sh {SSD_Disk_Name_Serial})" 2
#append_tabbed "HDD:$(./sata.sh {HDD_Disk_Name_Serial})" 2
endwin
}
# Start main loop
main_loop -t 2 "$@"