-
Notifications
You must be signed in to change notification settings - Fork 28
/
reboot.sh
100 lines (92 loc) · 3.14 KB
/
reboot.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
#!/bin/bash
# set -x
#传递参数为要执行的机器parameter
# set parame [lindex $argv 0]
#进入执行目录
sleep 600
chmod 777 /etc/rc.d/rc.local
cd /home/lpts-3.10.0
for line in $(cat flag.txt)
do
echo $line;
if [ $line -eq "1" ]; then
echo "/bin/bash /home/lpts-3.10.0/reboot.sh" >> /etc/rc.d/rc.local
./lpts.py --create -t stream -f jobs.xml -p parameters/$parame -n testname > /opt/stream.txt 2>&1
echo $?
./lpts.py --run -t stream -f jobs.xml >>/opt/stream.txt 2>&1
echo $?
echo "2" >flag.txt
reboot
elif [ $line -eq "2" ]; then
./lpts.py --create -t unixbench -f jobs.xml -p parameters/$parame -n testname > /opt/unixbench.txt 2>&1
echo $?
./lpts.py --run -t unixbench -f jobs.xml >>/opt/unixbench.txt 2>&1
echo $?
echo "3" >flag.txt
reboot
elif [ $line -eq "3" ]; then
echo $line
./lpts.py --create -t x11perf -f jobs.xml -p parameters/$parame -n testname > /opt/x11perf.txt 2>&1
echo $?
./lpts.py --run -t x11perf -f jobs.xml >>/opt/x11perf.txt 2>&1
echo "4" >flag.txt
reboot
elif [ $line -eq "4" ]; then
./lpts.py --create -t pingpong -f jobs.xml -p parameters/$parame -n testname > /opt/pingpong.txt 2>&1
echo $?
./lpts.py --run -t pingpong -f jobs.xml >>/opt/pingpong.txt 2>&1
echo $?
echo "5" >flag.txt
reboot
elif [ $line -eq "5" ]; then
mem_total=`free | grep Mem | awk '{print $2}'`
mem_1=$(expr $mem_total + 512000)
echo $mem_1
num2=1024000
mem_e=`echo "sclae=0; $mem_1/$num2" | bc`
for line_iozone in $(cat iozone_flag.txt)
do
if [ $line_iozone -eq "0" ]; then
mem_i=`echo "sclae=0; $mem_e/2" | bc`
echo "1" >iozone_flag.txt
echo "5" >flag.txt
elif [ $line_iozone -eq "1" ]; then
mem_i=$mem_e
echo "2" >iozone_flag.txt
echo "5" >flag.txt
elif [ $line_iozone -eq "2" ]; then
mem_i=$(expr $mem_e \* 2)
echo "0" >iozone_flag.txt
echo "6" >flag.txt
fi
done
str1="64c FILESIZE = $mem_i"
str2="g"
sed -i "$str1$str2" parameters/$parame
./lpts.py --create -t iozone -f jobs.xml -p parameters/$parame -n testname > /opt/iozone.txt 2>&1
echo $?
./lpts.py --run -t iozone -f jobs.xml >>/opt/iozone.txt 2>&1
echo $?
reboot
elif [ $line -eq "6" ]; then
./lpts.py --create -t bonnie -f jobs.xml -p parameters/$parame -n testname > /opt/bonnie.txt 2>&1
echo $?
./lpts.py --run -t bonnie -f jobs.xml >>/opt/bonnie.txt 2>&1
echo $?
echo "7" >flag.txt
reboot
elif [ $line -eq "7" ]; then
./lpts.py --create -t dbench_fio -f jobs.xml -p parameters/$parame -n testname > /opt/dbench_fio.txt 2>&1
echo $?
./lpts.py --run -t dbench_fio -f jobs.xml >>/opt/dbench_fio.txt 2>&1
echo $?
echo "8" >flag.txt
reboot
elif [ $line -eq "8" ]; then
./lpts.py --create -t lmbench -f jobs.xml -p parameters/$parame -n testname > /opt/lmbench.txt 2>&1
echo $?
./lpts.py --run -t lmbench -f jobs.xml >>/opt/lmbench.txt 2>&1
echo $?
echo "9" >flag.txt
fi
done