configure logging module
[chrisu/seepark.git] / seepark_webapp
1 #!/bin/sh
2
3 die() {
4         echo "$1" >&2
5         usage
6         exit 1
7 }
8
9 usage() {
10         echo "Usage: ./$ME <start|stop|restart>." >&2
11 }
12
13 ME=$(basename $0)
14 DIR=$(dirname $0)
15 ARG=$1
16
17 set -eu
18
19 [ -n "$ARG" ] || die "Missing argument."
20
21 start() {
22         cd "$DIR/web"
23         SEEPARKINI=../../seewasser.ini waitress-serve --listen=[::1]:8765 'seepark_web:app' &
24 }
25
26 stop() {
27         killall waitress-serve
28 }
29
30 case "$ARG" in
31         start)
32                 start
33                 ;;
34         stop)
35                 stop
36                 ;;
37         restart)
38                 stop
39                 sleep 1
40                 start
41                 ;;
42         help|-h|--help)
43                 usage
44                 ;;
45         *)
46                 die "Unknown argument '$ARG'." >&2
47                 ;;
48 esac
49
50 exit $?