-
Notifications
You must be signed in to change notification settings - Fork 4
/
raspi-info-check
56 lines (50 loc) · 2.88 KB
/
raspi-info-check
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
#!/bin/bash
#################################################################################
# _ _ __ #
# _ __ __ _ ___ _ __ (_) (_)_ __ / _| ___ #
# | '__/ _` / __| '_ \| |_____| | '_ \| |_ / _ \ #
# | | | (_| \__ \ |_) | |_____| | | | | _| (_) | #
# |_| \__,_|___/ .__/|_| |_|_| |_|_| \___/ #
# |_| #
# #
# #
# MIT License #
# Copyright (c) 2019-2024 Massimo Pissarello #
# Permission is hereby granted, free of charge, to any person obtaining a copy #
# of this software and associated documentation files (the "Software"), to deal #
# in the Software without restriction, including without limitation the rights #
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell #
# copies of the Software, and to permit persons to whom the Software is #
# furnished to do so, subject to the following conditions: #
# The above copyright notice and this permission notice shall be included in #
# all copies or substantial portions of the Software. #
# #
#################################################################################
COLOR=`shuf -i91-96 -n1`
echo && echo && echoCOLOR=$(shuf -i91-96 -n1)
echo -e '\n\n\e[0m\e['$COLOR'm RASPI-INFO-CHECK'
echo -e '\e[0m\e[0m How often do you want to update the data?'
echo -e ' Press a number key from 1 to 9 to set the interval in seconds'
echo -e ' Press any letter key for the default interval (5 seconds)'
read -p " Please do your choice " -n 1 -r -s
echo
if ! [[ $REPLY =~ ^[1-9]$ ]]; then
REPLY=5
fi
echo -e '\e[0m\e['$COLOR'm Update interval set to '${REPLY}' seconds.'
echo
echo -e ' Press CTRL + C to exit'
echo -e '\e[0m'
echo " Time Load average Temp Clock FreeMem Volt"
while true; do
let ++Counter
if [ ${Counter} -eq 15 ]; then
Counter=0; fi
LoadAv=$(uptime | awk -F'[a-z]:' '{print $2}')
Temp=$(vcgencmd measure_temp | cut -f2 -d=)
Clockspeed=$(vcgencmd measure_clock arm | awk -F"=" '{printf ("%0.0f",$2/1000000); }' )
CoreVolt=$(vcgencmd measure_volts | cut -f2 -d= | sed 's/000//')
FreeMem=$(free --mega | grep '^Mem' | awk '{ print $4 }')
echo -e " $(date '+%H:%M:%S') ${LoadAv} ${Temp} $(printf '%4s' ${Clockspeed})MHz ${FreeMem} ${CoreVolt}"
sleep $REPLY
done