Add simplified local setup
[aai/test-config.git] / local-setup / src / main / docker / janusgraph / entrypoint.sh
diff --git a/local-setup/src/main/docker/janusgraph/entrypoint.sh b/local-setup/src/main/docker/janusgraph/entrypoint.sh
new file mode 100755 (executable)
index 0000000..8108866
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# run short-living command and prevent docker from stopping
+
+JANUS_EXEC="janusgraph/bin/janusgraph.sh"
+
+onStart() {
+  ${JANUS_EXEC} start
+}
+
+onStop() {
+  ${JANUS_EXEC} stop
+}
+
+waitLoop() {
+  tail -f /dev/null &
+  wait $!
+}
+
+trap 'onStop; exit 0' SIGTERM SIGINT
+
+onStart || exit $?
+
+waitLoop
\ No newline at end of file