changeset 217:8864f8d6e0a2

Cygwin/Windows compatibility for thermostat-mongodb.sh This small patch allows thermostat-mongodb.sh to run under Cygwin on Windows. (on Windows, the --fork option doesn't work, so we need to spawn using '&') Reviewed-by: sgehwolf Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-July/024310.html
author Simon Tooke <stooke@redhat.com>
date Wed, 26 Jul 2017 09:49:28 -0400
parents 638f67045739
children 61021e0a81d2
files distribution/src/bin/thermostat-mongodb.sh
diffstat 1 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/distribution/src/bin/thermostat-mongodb.sh	Tue Jul 25 15:49:55 2017 -0400
+++ b/distribution/src/bin/thermostat-mongodb.sh	Wed Jul 26 09:49:28 2017 -0400
@@ -96,12 +96,20 @@
     mkdir -p ${DB_PATH}
     mkdir -p ${DATA_PATH}
 
-    mongod --quiet ${MONGO_FORK_ARG} --nohttpinterface --bind_ip ${IP} --nojournal --dbpath ${DATA_PATH} --logpath ${LOG_PATH} --pidfilepath ${PID_PATH} --port ${PORT} --auth
-
-    if [ ! -f ${SETUP_PATH} ]; then
-        sleep 3
-        touch ${SETUP_PATH}
-        mongo ${IP}:${PORT} ${JS_PATH}
+    if [ $CYGWIN_MODE -eq 1 ]; then
+        mongod --quiet --nohttpinterface --bind_ip ${IP} --nojournal --dbpath ${DATA_PATH} --logpath ${LOG_PATH} --pidfilepath ${PID_PATH} --port ${PORT} --auth&
+        if [ ! -f ${SETUP_PATH} ]; then
+            sleep 3
+            touch ${SETUP_PATH}
+            mongo ${IP}:${PORT} `cygpath -w ${JS_PATH}`
+        fi
+    else
+        mongod --quiet ${MONGO_FORK_ARG} --nohttpinterface --bind_ip ${IP} --nojournal --dbpath ${DATA_PATH} --logpath ${LOG_PATH} --pidfilepath ${PID_PATH} --port ${PORT} --auth
+        if [ ! -f ${SETUP_PATH} ]; then
+            sleep 3
+            touch ${SETUP_PATH}
+            mongo ${IP}:${PORT} ${JS_PATH}
+        fi
     fi
 fi