forked from gogo-easy/ngr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice_gw.sh
executable file
·88 lines (79 loc) · 1.49 KB
/
service_gw.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#version_1.0
#!/bin/bash
source /etc/profile
ENV="xxx"
app_name=$2
function help() {
echo "Usage: $0 start|reload|stop|restart"
}
#function port_check(){
# status=`curl -o /dev/null -I -s -w '%{http_code}' http://localhost:80`
# if [[ $status == 200 || $status == 302 ]];then
# echo "port:80 ok"
# echo "SUCCESS"
# exit 0
# else
# echo "port:80 check error"
# exit 1
# fi
#}
function start(){
ngr start
if [ $? != 0 ];then
echo "ngr start error"
else
echo "ngr started"
echo "SUCCESS"
exit 0
fi
}
function restart(){
ngr restart
if [ $? != 0 ];then
echo "ngr restart error"
else
echo "ngr restarted"
echo "SUCCESS"
exit 0
fi
}
function reload(){
make install-gateway profile=$ENV app_name=$app_name
if [ $? != 0 ];then
echo "ngr install error"
else
echo "ngr installed"
ngr reload
if [ $? != 0 ];then
echo "ngr reload error"
else
echo "ngr reloaded"
echo "SUCCESS"
exit 0
fi
fi
}
function stop(){
ngr stop
if [ $? != 0 ];then
echo "ngr stop error"
else
echo "ngr stoped"
echo "SUCCESS"
exit 0
fi
}
#输入提示
if [ "$1" == "" ]; then
help
elif [ "$1" == "stop" ]; then
stop
elif [ "$1" == "start" ]; then
start
elif [ "$1" == "restart" ]; then
restart
elif [ "$1" == "reload" ]; then
reload
else
help
fi