Update control configure
[bottlenecks.git] / rubbos / rubbos_scripts / 1-1-1 / scripts / CONTROL_rubbos_exec.sh
1 #!/bin/bash
2
3 set -x
4
5 cd /bottlenecks/rubbos/rubbos_scripts/1-1-1
6 source set_bottlenecks_rubbos_env.sh
7 export scp_options='-o StrictHostKeyChecking=no -o BatchMode=yes'
8
9 scp $WORK_HOME/monitors_files/oprofile_start.sh $MYSQL1_HOST:/tmp/
10
11 echo "Starting RUBBoS"
12
13 ssh $RUBBOS_RESULTS_HOST "
14   mkdir -p $RUBBOS_RESULTS_DIR_BASE
15 "
16 ssh $BENCHMARK_HOST "
17   mkdir -p $TMP_RESULTS_DIR_BASE/$RUBBOS_RESULTS_DIR_NAME
18 "
19
20 #TODO use for loop to genrate rubbos.properties file 200 ~ 1700
21 for i in "rubbos.properties_200"
22 do
23
24   ssh $BENCHMARK_HOST "
25     source /bottlenecks/rubbos/rubbos_scripts/1-1-1/set_bottlenecks_rubbos_env.sh
26     rm -f $RUBBOS_HOME/Client/rubbos.properties
27   "
28   scp $OUTPUT_HOME/rubbos_conf/$i $BENCHMARK_HOST:$RUBBOS_HOME/Client/rubbos.properties
29
30   #echo "Resetting all data"
31   #$OUTPUT_HOME/scripts/reset_all.sh
32
33   # Browsing Only
34   echo "Start Browsing Only with $i"
35   echo "Removing previous logs..."
36   ssh $HTTPD_HOST "rm -f $HTTPD_HOME/logs/*log"
37   ssh $TOMCAT1_HOST "rm -f $CATALINA_HOME/logs/*"
38   ssh $MYSQL1_HOST "rm -f $MYSQL_HOME/run/*.log $RUBBOS_APP/mysql_mon-*"
39
40   $OUTPUT_HOME/scripts/start_all.sh
41   sleep 15
42
43   for host in $BENCHMARK_HOST $CLIENT1_HOST $CLIENT2_HOST $CLIENT3_HOST \
44               $CLIENT4_HOST $HTTPD_HOST $TOMCAT1_HOST $MYSQL1_HOST
45   do
46     ssh $host "rm -f $RUBBOS_APP/sar-* $RUBBOS_APP/ps-* $RUBBOS_APP/iostat-*"
47   done
48   ssh $MYSQL1_HOST "rm -f /tmp/*.log"
49   ssh $MYSQL1_HOST chmod 777 /tmp/oprofile_start.sh
50   #ssh $MYSQL1_HOST "
51   #  cd /tmp
52   #  ./oprofile_start.sh
53   #" &
54
55   ssh $BENCHMARK_HOST "
56     source /bottlenecks/rubbos/rubbos_scripts/1-1-1/set_bottlenecks_rubbos_env.sh
57
58     cd $RUBBOS_HOME/bench
59     \rm -r 20*
60
61     # Execute benchmark
62     echo "execute benchmark"
63     ./rubbos-servletsBO.sh
64
65     # Collect results
66     echo "The benchmark has finished. Now, collecting results..."
67     cd 20*
68     for host in $BENCHMARK_HOST $CLIENT1_HOST $CLIENT2_HOST $CLIENT3_HOST \
69                 $CLIENT4_HOST $HTTPD_HOST $TOMCAT1_HOST $MYSQL1_HOST
70     do
71       for f in sar-* ps-* iostat-* mysql_mon-* postgres_lock-*
72       do
73         scp $scp_options \$host:$RUBBOS_APP/\$f ./
74       done
75     done
76     cd ..
77     mv 20* $TMP_RESULTS_DIR_BASE/$RUBBOS_RESULTS_DIR_NAME/
78   "
79
80   # TODO debug the rest of sciripts
81   exit 0
82   #$OUTPUT_HOME/scripts/stop_all.sh
83   $OUTPUT_HOME/scripts/kill_all.sh
84   sleep 15
85   echo "End Browsing Only with $i"
86
87   # Read/Write
88
89 done
90
91 echo "Processing the results..."
92 ssh $BENCHMARK_HOST "
93   cd $TMP_RESULTS_DIR_BASE
94   cd $RUBBOS_RESULTS_DIR_NAME
95   scp $RUBBOS_RESULTS_HOST:$RUBBOS_RESULTS_DIR_BASE/calc-sarSummary.prl ../
96   ../calc-sarSummary.prl
97
98   rm -f 20*/*.bin
99
100   cd ../
101   tar zcvf $RUBBOS_RESULTS_DIR_NAME.tgz $RUBBOS_RESULTS_DIR_NAME
102   scp $RUBBOS_RESULTS_DIR_NAME.tgz $RUBBOS_RESULTS_HOST:$RUBBOS_RESULTS_DIR_BASE/
103 "
104
105 echo "Finish RUBBoS"
106
107 set +x
108