-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhello_apache.sh
executable file
·58 lines (47 loc) · 1.15 KB
/
hello_apache.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
55
56
57
58
#!/bin/bash
provider=$1
cat << EOF > answers.conf
[general]
provider = $provider
[helloapache-app]
image = centos/httpd
hostport = 80
EOF
ret=0
echo "Running projectatomic/helloapache"
atomicapp run --destination=./ projectatomic/helloapache
res=$?
if [ $res -gt $ret ]; then
ret=$res
fi
if [ $ret -eq 0 ]; then
if [ "$provider" = "kubernetes" ]; then
total=0
kubectl get pods | egrep -q "^helloapache\s+1/1s+Running\s+"
while [ $? -ne 0 -a $total -lt 120 ]; do
sleep 2
total=$((total+2))
kubectl get pods | egrep -q "^helloapache\s+1/1\s+Running\s+"
done
echo "Checking kubernetes pod"
kubectl get pods
kubectl get pods | egrep -q "^helloapache\s+1/1\s+Running\s+"
res=$?
if [ $res -gt $ret ]; then
ret=$res
fi
fi
echo "Running curl"
curl http://localhost/ | grep 'Apache HTTP Server Test Page powered by CentOS' >& /dev/null
res=$?
if [ $res -gt $ret ]; then
ret=$res
fi
fi
echo "Stopping projectatomic/helloapache"
atomicapp stop ./
res=$?
if [ $res -gt $ret ]; then
ret=$res
fi
exit $ret