-
Notifications
You must be signed in to change notification settings - Fork 0
/
jgate
57 lines (48 loc) · 817 Bytes
/
jgate
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
#!/bin/bash
PROC='gunicorn jumpgate'
function is_running() {
local __result=$1
local __running=`pgrep -f "${PROC}"`
eval $__result="'${__running:-0}'"
}
function start() {
is_running running
if [ "$running" == "0" ]; then
echo "Starting jumpgate..."
nohup gunicorn "jumpgate.wsgi:make_api()" --bind=0.0.0.0:5000 --timeout=600 --access-logfile=- -w 4 > /var/log/jumpgate.log 2>&1 &
else
echo "Jumpgate already running"
fi
}
function stop() {
is_running running
if [ "$running" != "0" ]; then
echo "Stopping jumpgate..."
pkill -f "${PROC}"
else
echo "Jumpgate not running"
fi
}
function restart() {
stop
start
}
function usage() {
echo "Usage: jumpgate [stop|start|restart]"
}
case $1 in
'start')
start
;;
'stop')
stop
;;
'restart')
restart
;;
*)
usage
exit 1
;;
esac
exit 0