-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathelasticapp-install.sh
More file actions
36 lines (28 loc) · 931 Bytes
/
elasticapp-install.sh
File metadata and controls
36 lines (28 loc) · 931 Bytes
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
#!/bin/bash
FILE_NAME="file.php"
TEST_FILE="/var/www/html/$FILE_NAME"
if [ -z ${STRESS_SECONDS+x} ]; then
echo "STRESS_SECONDS is unset";
STRESS_SECONDS="60"
else
echo "STRESS_SECONDS is set to '$STRESS_SECONDS'";
fi
if [ -z ${CORES+x} ]; then
echo "CORES is unset";
CORES="4"
else
echo "CORES is set to '$CORES'";
fi
sudo apt-get update
sudo apt-get install apache2 stressapptest -y
sudo apt-get install php5 -y
sudo apt-get install libapache2-mod-php5 -y
sudo /etc/init.d/apache2 restart
echo "<?php" >> $TEST_FILE
echo "header('Content-Type: text/plain');" >> $TEST_FILE
echo 'echo "Server IP: {$_SERVER['SERVER_ADDR']}";' >> $TEST_FILE
echo 'echo "\nClient IP: {$_SERVER['REMOTE_ADDR']}";' >> $TEST_FILE
echo 'echo "\nX-Forwarded-for: {$_SERVER['HTTP_X_FORWARDED_FOR']}\n";' >> $TEST_FILE
echo "shell_exec('stressapptest -C $CORES -s $STRESS_SECONDS');" >> $TEST_FILE
echo "?>" >> $TEST_FILE
cat $TEST_FILE