-
Notifications
You must be signed in to change notification settings - Fork 67
/
loop.sh
executable file
·47 lines (40 loc) · 1.16 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
#!/bin/bash
LOGFILE=/var/log/sitespeed.io/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 /var/log/sitespeed.io.log)
CONTROL_FILE="./sitespeed.run"
# 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 in Docker (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
result=$?
if [ $result -ne 0 ]; then
echo 'Stop the loop $result'
exit 0;
fi
done