-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·70 lines (64 loc) · 1.44 KB
/
start.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
#!/bin/bash
#
# Starts the developer appserver.
#
# Author: FracPete (fracpete at waikato dot ac dot nz)
# Version: $Revision: 855 $
# print usage of script
function usage() {
echo
echo "Usage: ${0##*/} [-g dir] [-p bin] [-H host] [-P port] [-h]"
echo
echo "Starts the developer appserver."
echo
echo "-g <dir>"
echo " Google Appengine root directory, default: $GAE_DEFAULT"
echo "-p <bin>"
echo " Path to python 2.7 executable, default: $PY_BIN_DEFAULT"
echo "-H <host>"
echo " The host to bind to, default: $HOST_DEFAULT"
echo "-P <port>"
echo " The port to use for serving the content, default: $PORT_DEFAULT"
echo "-h"
echo " print this help"
echo
}
# set defaults
PY_BIN_DEFAULT="/usr/bin/python2.7"
PY_BIN=$PY_BIN_DEFAULT
GAE_DEFAULT="/usr/local/google_appengine-1.8.2"
GAE=$GAE_DEFAULT
HOST_DEFAULT="localhost"
HOST=$HOST_DEFAULT
PORT_DEFAULT="8080"
PORT=$PORT_DEFAULT
# interprete parameters
while getopts ":hg:p:H:P:" flag
do
case $flag in
g) GAE=$OPTARG
;;
p) PY_BIN=$OPTARG
;;
H) HOST=$OPTARG
;;
P) PORT=$OPTARG
;;
h) usage
exit 0
;;
*) usage
exit 1
;;
esac
done
# determine google appengine root directory
if [ ! -d $GAE ]
then
echo
echo "Google Appengine directory invalid: $GAE"
echo
exit 2
fi
echo "Starting dev appserver $HOST:$PORT"
$PY_BIN $GAE/dev_appserver.py --host=$HOST --port $PORT .