forked from sitespeedio/dashboard.sitespeed.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloop.sh
executable file
·54 lines (47 loc) · 1.33 KB
/
loop.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
#!/bin/bash
LOGFILE=/tmp/sitespeed.io.log
exec > $LOGFILE 2>&1
# In your curent dir we will place a file called sitespeed.run that shows that the tests are running
# If you want to stop the tests gracefully, remove that file: rm sitespeed.io and wait for
# the tests to finish (tail -f /tmp/sitespeed.io)
CONTROL_FILE="./sitespeed.run"
# The first parameter is the server name, so we can find the right tests to run
if [ -z "$1" ]
then
echo "Missing server input! You need to run with a parameter that gives the path to the configuration "
exit 1
fi
SERVER=$1
# You cannot start multiple instances!
if [ -f "$CONTROL_FILE" ]
then
echo "$CONTROL_FILE exist, do you have running tests?"
exit 1;
else
touch $CONTROL_FILE
fi
# Help us end on demand
function control() {
if [ -f "$CONTROL_FILE" ]
then
echo "$CONTROL_FILE found. Make another run ..."
else
echo "$CONTROL_FILE not found - stopping after cleaning up ..."
docker system prune --all --volumes -f
echo "Exit"
exit 1
fi
}
# To get throttle to work (https://github.com/sitespeedio/throttle)!
sudo modprobe ifb numifbs=1
while true
do
## For each iteration, we pull the latest code from git and run
git pull
source run.sh $SERVER
result=$?
if [ $result -ne 0 ]; then
echo 'Stop the loop $result'
exit 0;
fi
done