Add minimal start/stop script based on Gregor's seepark start/stop script.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Thu, 9 May 2019 19:04:33 +0000 (19:04 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Thu, 9 May 2019 19:04:33 +0000 (19:04 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrfeed/trunk@2805 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrfeed_webapp.sh [new file with mode: 0755]

diff --git a/wrfeed_webapp.sh b/wrfeed_webapp.sh
new file mode 100755 (executable)
index 0000000..42aca17
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+die() {
+       echo "$1" >&2
+       usage
+       exit 1
+}
+
+usage() {
+       echo "Usage: ./$ME <start|stop|restart>." >&2
+}
+
+ME=$(basename $0)
+DIR=$(dirname $0)
+ARG=$1
+
+set -eu
+
+[ -n "$ARG" ] || die "Missing argument."
+
+start() {
+       cd "$DIR"
+       WRFEED_SETTINGS=development.cfg waitress-serve --listen=[::1]:8766 'wrfeed:app' &
+}
+
+stop() {
+       killall waitress-serve
+}
+
+case "$ARG" in
+       start)
+               start
+               ;;
+       stop)
+               stop
+               ;;
+       restart)
+               stop
+               sleep 1
+               start
+               ;;
+       help|-h|--help)
+               usage
+               ;;
+       *)
+               die "Unknown argument '$ARG'." >&2
+               ;;
+esac
+
+exit $?