-
Notifications
You must be signed in to change notification settings - Fork 0
/
perseus.sh
executable file
·44 lines (37 loc) · 1.22 KB
/
perseus.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
#!/bin/bash
# Perseus run script
# Basic scripting guide is here:
# https://likegeeks.com/linux-bash-scripting-awesome-guide-part3/#Bash-Scripting-Options
MSG="Usage: script options: -d|p for development/production with parameters: start|stop \ne.g. ./perseus.sh -d start\n"
# Provide a help message if the script was called without options or parameters
if ! [ -n "$1" ] ; then printf "$MSG" ; fi
# If options were provided, handle them
while [ -n "$1" ]
do
case "$1" in
# TODO: Re-implment for any new reverse proxy
# Run in production mode - spin up a thin instance on port 5000
-p) param=$2
if ! [ -n "$param" ] ; then echo "start|stop required"
elif [ $param = "start" ] ; then
thin -s 1 -C config.yml -R config.ru start
elif [ $param = "stop" ] ; then
thin -s 1 -C config.yml stop
fi
shift ;;
# Run in development mode - spin up a thin instance on port 5000
-d) param="$2"
if ! [ -n "$param" ] ; then echo "start|stop required"
elif [ $param = "start" ] ; then
thin -s 1 -C config.yml -R config.ru start
elif [ $param = "stop" ] ; then
thin -s 1 -C config.yml stop
fi
shift ;;
# Handle unknown options
*)
printf "$MSG"
shift ;;
esac
shift
done