-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy paththermal_wifi.sh
executable file
·69 lines (57 loc) · 1.72 KB
/
thermal_wifi.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
#!/bin/bash
#################################################################################
# Copyright 2019 Technexion Ltd.
#
# Author: Richard Hu <richard.hu@technexion.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#################################################################################
EXEC_PATH=$(dirname "$0")
FILE_NAME=$(basename -- "$0")
FILE_NAME="${FILE_NAME%.*}"
#echo "$EXEC_PATH"
#echo "$FILE_NAME"
source "$EXEC_PATH"/thermal_basic_func.sh
LOG=/"$FILE_NAME".log
if [ -f "$LOG" ]; then
rm "$LOG"
fi
echo LOG file is created under "$LOG"
thermal_wifi()
{
PID_THIS=$$
echo "PID is: $PID_THIS"
wfi_config_server
while true
do
sleep 1
cpu_usage=$(get_cpu_usage)
temperature=$(get_temperature)
echo
ELAPSE_TIME=$(ps -p "$PID_THIS" -o etime | awk 'FNR == 2 {print $1}')
echo "===============================" | tee -a "$LOG"
printf "Running WIFI burning test \n" | tee -a "$LOG"
printf "Elapsed time: %s \n" "$ELAPSE_TIME" | tee -a "$LOG"
printf "CPU usage: %s \n" "$cpu_usage" | tee -a "$LOG"
printf "Temperature: %s degree \n" "$temperature" | tee -a "$LOG"
wifi_burn "$LOG"
echo "===============================" | tee -a "$LOG"
sync
sleep 3
done
}
trap_ctrlc ()
{
# perform cleanup here
echo "Ctrl-C caught...performing clean up"
echo "killall iperf3"
echo
killall iperf3
# exit shell script with error code 2
# if omitted, shell script will continue execution
exit 2
}
trap "trap_ctrlc" 2
thermal_wifi