1 | #!/bin/bash |
---|
2 | IP_LIST="192.168.100.1 192.168.100.2 192.168.100.4 192.168.100.5 192.168.100.11 192.168.100.12 192.168.100.13 192.168.100.14 192.168.100.21 192.168.100.22 192.168.100.24 192.168.100.25" |
---|
3 | export LANG=en_US |
---|
4 | export LC_ALL=en_US |
---|
5 | log_start=$(date +"%y%m%d-%H%M%S_") |
---|
6 | hostname=$(hostname) |
---|
7 | log_file="/root/log/${log_start}diskfull-benchmark.log" |
---|
8 | status_file="/root/log/${log_start}diskfull-benchmark-status.log" |
---|
9 | status_file="/dev/null" |
---|
10 | local_zip="/root/log/${log_start}${hostname}_diskfull.tar.gz" |
---|
11 | echo "0. Rebooting...." > $log_file |
---|
12 | echo "0. Rebooting...." |
---|
13 | /opt/drbl/sbin/dcs -h "$IP_LIST" local > $status_file 2>&1 |
---|
14 | source /home/jazz/.bash_aliases |
---|
15 | up-host-a > /root/.dsh/machines.list |
---|
16 | rm -f /root/.ssh/known_hosts |
---|
17 | mkdir -p /root/log/ |
---|
18 | |
---|
19 | function mydsh() |
---|
20 | { |
---|
21 | dsh -a -c "date > /root/log/$2.time.$1; /usr/bin/time -a -o /root/log/$2.time.$i $3; date >> /root/log/$2.time.$1" >> $status_file 2>&1 |
---|
22 | } |
---|
23 | |
---|
24 | echo "START diskfull Benchmark ...." >> $log_file |
---|
25 | for ((i=1;i<=10;i++)); do |
---|
26 | echo "[$i] 1. Booting...." >> $log_file |
---|
27 | echo "[$i] 1. Booting...." |
---|
28 | dsh -a -c "reboot" >> $status_file 2>&1 |
---|
29 | `date >> $log_file` |
---|
30 | sleep 120 |
---|
31 | dsh -a -c "echo 3 > /proc/sys/vm/drop_caches" |
---|
32 | echo "[$i] 2. Running dd ...." >> $log_file |
---|
33 | echo "[$i] 2. Running dd ...." |
---|
34 | `date >> $log_file` |
---|
35 | mydsh "$i" "dd" "dd if=/dev/zero of=/root/E2CC.img bs=1M count=1024" |
---|
36 | `date >> $log_file` |
---|
37 | sleep 120 |
---|
38 | echo "[$i] 3. Running tar ...." >> $log_file |
---|
39 | echo "[$i] 3. Running tar ...." |
---|
40 | `date >> $log_file` |
---|
41 | mydsh "$i" "tar" "tar zcvf /root/E2CC.img.tar.gz /root/E2CC.img" |
---|
42 | `date >> $log_file` |
---|
43 | sleep 120 |
---|
44 | echo "[$i] 4. Running bonnie++ ...." >> $log_file |
---|
45 | echo "[$i] 4. Running bonnie++ ...." |
---|
46 | `date >> $log_file` |
---|
47 | # force to run bonnie++ with 128MB RAM (-r), 256MB (-s) |
---|
48 | mydsh "$i" "bonnie++" "bonnie++ -u root -d /root -r 128 -s 256" |
---|
49 | `date >> $log_file` |
---|
50 | sleep 120 |
---|
51 | echo "[$i] *. Download Kernel ...." >> $log_file |
---|
52 | echo "[$i] *. Download Kernel ...." |
---|
53 | `date >> $log_file` |
---|
54 | mydsh "$i" "download-kernel" "wget -O /tmp/linux-2.6.30.tar.bz2 http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.tar.bz2 -o /tmp/linux-2.6.30.log" |
---|
55 | `date >> $log_file` |
---|
56 | echo "[$i] *. Extract Kernel ...." >> $log_file |
---|
57 | echo "[$i] *. Extract Kernel ...." |
---|
58 | `date >> $log_file` |
---|
59 | mydsh "$i" "extrac-kernel" "tar jxvf /tmp/linux-2.6.30.tar.bz2 -C /tmp; rm -f /tmp/linux-2.6.30.tar.bz2" |
---|
60 | `date >> $log_file` |
---|
61 | echo "[$i] *. Configure Kernel ...." >> $log_file |
---|
62 | echo "[$i] *. Configure Kernel ...." |
---|
63 | `date >> $log_file` |
---|
64 | mydsh "$i" "make-allnoconf" "make -C /tmp/linux-2.6.30 allnoconfig" |
---|
65 | `date >> $log_file` |
---|
66 | echo "[$i] 5. Running make -j 1 once ...." >> $log_file |
---|
67 | echo "[$i] 5. Running make -j 1 once ...." |
---|
68 | `date >> $log_file` |
---|
69 | mydsh "$i-1" "make-clean" "make clean -C /tmp/linux-2.6.30" |
---|
70 | mydsh "$i-1" "make-j1" "make -j 1 -C /tmp/linux-2.6.30" |
---|
71 | `date >> $log_file` |
---|
72 | sleep 120 |
---|
73 | echo "[$i] 6. Running make -j 2 once ...." >> $log_file |
---|
74 | echo "[$i] 6. Running make -j 2 once ...." |
---|
75 | `date >> $log_file` |
---|
76 | mydsh "$i-1" "make-clean" "make clean -C /tmp/linux-2.6.30" |
---|
77 | mydsh "$i-1" "make-j2" "make -j 2 -C /tmp/linux-2.6.30" |
---|
78 | `date >> $log_file` |
---|
79 | sleep 120 |
---|
80 | echo "[$i] 7. Running make -j 3 twice ...." >> $log_file |
---|
81 | echo "[$i] 7. Running make -j 3 twice ...." |
---|
82 | `date >> $log_file` |
---|
83 | mydsh "$i-1" "make-clean" "make clean -C /tmp/linux-2.6.30" |
---|
84 | mydsh "$i-1" "make-j3" "make -j 3 -C /tmp/linux-2.6.30" |
---|
85 | mydsh "$i-2" "make-clean" "make clean -C /tmp/linux-2.6.30" |
---|
86 | mydsh "$i-2" "make-j3" "make -j 3 -C /tmp/linux-2.6.30" |
---|
87 | `date >> $log_file` |
---|
88 | sleep 120 |
---|
89 | echo "[$i] 8. Running make -j 4 twice ...." >> $log_file |
---|
90 | echo "[$i] 8. Running make -j 4 twice ...." |
---|
91 | `date >> $log_file` |
---|
92 | mydsh "$i-1" "make-clean" "make clean -C /tmp/linux-2.6.30" |
---|
93 | mydsh "$i-1" "make-j4" "make -j 4 -C /tmp/linux-2.6.30" |
---|
94 | mydsh "$i-2" "make-clean" "make clean -C /tmp/linux-2.6.30" |
---|
95 | mydsh "$i-2" "make-j4" "make -j 4 -C /tmp/linux-2.6.30" |
---|
96 | `date >> $log_file` |
---|
97 | done |
---|
98 | mydsh "F" "collect" "tar zcvf $local_zip /root/log/*.time.*" |
---|