-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsysInfo.sh.txt
More file actions
77 lines (75 loc) · 1.38 KB
/
sysInfo.sh.txt
File metadata and controls
77 lines (75 loc) · 1.38 KB
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
tput civis
oldnetu=0
oldtime=0
netout () {
if [ $1 -gt 999999 ]
then
let x=$1/1000000
echo $x MB
elif [ $1 -gt 999 ]
then
let x=$1/1000
echo $x KB
else
echo $1 B
fi
return 0
}
while true
do
#czas
a=$(cat /proc/uptime)
t=${a%%.*.*}
let s=t%60
let m=(t/60)%60
let h=(t/3600)%24
let d=t/86400
#bateria
battery=$(cat /sys/class/power_supply/BAT1/uevent)
battery=${battery%POWER_SUPPLY_CAPACITY_*}
battery=${battery#*CAPACITY=}
#net
net=$(cat /proc/net/dev)
time=$(cat /proc/uptime)
time=${time%% *}
time=${time//.}
let delta=time-oldtime
oldtime=$time
netd=${net##*wlp2s0:}
netu=$(echo $netd | awk '{ print $9; }')
netd=$(echo $netd | awk '{ print $1; }')
let avgdownload=netd/t
let nowdownload=(netd-oldnetd)*100/delta
let avgupload=netu/t
let nowupload=(netu-oldnetu)*100/delta
oldnetd=$netd
oldnetu=$netu
#spanko
sleep 1
clear && clear
#wypisywanie
tput cup 1 1
echo $d days $h:$m:$s
tput cup 1 126
echo $battery % of battery
tput cup 3 1
echo DOWNLOAD
tput cup 5 1
echo avg:
tput cup 5 6
netout $avgdownload
tput cup 6 1
echo now:
tput cup 6 6
netout $nowdownload
tput cup 8 1
echo UPLOAD
tput cup 10 1
echo avg:
tput cup 10 6
netout $avgupload
tput cup 11 1
echo now:
tput cup 11 6
netout $nowupload
done