-
Notifications
You must be signed in to change notification settings - Fork 0
/
sleep.sh
executable file
·34 lines (31 loc) · 902 Bytes
/
sleep.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
#!/bin/bash
i=1
n=5
sleep_log="/root/test_sleep.log"
dmesg_file="/root/dmesg.log"
[[ -e "$dmesg_file" ]] && {
mv $dmesg_file /root/dmesg_bak.log
echo "mv $dmesg_file /root/dmesg_bak.log"
echo "mv $dmesg_file /root/dmesg_bak.log" >> $sleep_log
}
echo "echo deep > /sys/power/mem_sleep"
echo "echo deep > /sys/power/mem_sleep" > $sleep_log
echo deep > /sys/power/mem_sleep
for ((i = 1; i <= n; i++)); do
echo "****$i times ****: rtcwake -m mem -s 20"
echo "****$i times ****: rtcwake -m mem -s 20" >> $sleep_log
rtcwake -m mem -s 20
[[ "$?" -eq 0 ]] || {
echo "$i times s3 sleep failed return not 0!"
echo "$i times s3 sleep failed return not 0!" >> $sleep_log
echo "dmesg > $dmesg_file"
dmesg > $dmesg_file
exit 1
}
echo "sleep 10"
echo "sleep 10" >> $sleep_log
sleep 10
done
echo "sleep test OK!" >> $sleep_log
echo "dmesg > $dmesg_file"
dmesg > $dmesg_file