forked from AllonKleinLab/SPRING_dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_server.sh
executable file
·50 lines (44 loc) · 1.28 KB
/
start_server.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
#!/bin/bash
function print_help() {
echo "Usage: ./start_server.sh [OPTIONS]"
echo "Start the Flask server with optional debugging and port specification."
echo ""
echo "Options:"
echo " -d, --debug Run the server in debug mode."
echo " -p, --port Set the port of the server. Requires a number as an argument."
echo " -h, --help Show this help message and exit."
echo ""
echo "Examples:"
echo " ./start_server.sh Start the server on the default port."
echo " ./start_server.sh -d Start the server in debug mode on default port."
echo " ./start_server.sh -p 8000 Start the server on port 8000."
echo " ./start_server.sh -d -p 8000 Start the server in debug mode on port 8000."
}
command="python3 flask_server.py"
debug_mode=""
port=""
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-d|--debug)
debug_mode=" --debug"
shift
;;
-p|--port)
port=" --port $2"
shift
shift
;;
-h|--help)
print_help
exit 0
;;
*)
# unknown option
;;
esac
done
command="$command$debug_mode$port"
echo "Running command: $command"
eval $command