about summary refs log tree commit diff
path: root/bin/genenetwork2
diff options
context:
space:
mode:
Diffstat (limited to 'bin/genenetwork2')
-rwxr-xr-xbin/genenetwork228
1 files changed, 19 insertions, 9 deletions
diff --git a/bin/genenetwork2 b/bin/genenetwork2
index f32c76eb..f6ae3807 100755
--- a/bin/genenetwork2
+++ b/bin/genenetwork2
@@ -31,7 +31,7 @@
 #
 #   env GN2_PROFILE=~/opt/gn-latest-guix ./bin/genenetwork2 ./etc/default_settings.py -gunicorn "--bind 0.0.0.0:8000 --workers=2 --chdir wqflask/gunicorn/ wsgi"
 
-SCRIPT=$(readlink -f "$0")
+SCRIPT=$(realpath "$0")
 GN2_BASE_DIR=$(dirname $(dirname "$SCRIPT"))
 GN2_ID=$(cat /etc/hostname):$(basename $GN2_BASE_DIR)
 
@@ -50,15 +50,25 @@ else
 fi
 echo GN_VERSION=$GN_VERSION
 
+if [ "$1" = "-c" -o "$1" = "-gunicorn" ]; then
+    echo "Can not use $1 switch without default settings file"
+    exit 1
+fi
 # Handle settings parameter (can be .py or .json)
-settings=$1
-ext="${settings##*.}"
-if [ -z "$settings" -o "$ext" = "json" -o "$ext" = "JSON" ]; then
-    overrides=$settings
+settings=$(realpath "$1")
+if [ ! -e $settings ]; then
     settings=$GN2_BASE_DIR/etc/default_settings.py
 else
     shift
 fi
+
+ext="${settings##*.}"
+if [ "$ext" = "json" -o "$ext" = "JSON" ]; then
+    overrides=$settings
+else
+    echo $settings
+fi
+
 if [ ! -e $settings ]; then
     echo "ERROR: can not locate settings file - pass it in the command line"
     exit 1
@@ -132,12 +142,12 @@ if [ "$1" = '-c' ] ; then
     exit 0
 fi
 if [ "$1" = '-gunicorn' ] ; then
-    cd $GN2_BASE_DIR
-    cmd=${2}
+    cd $GN2_BASE_DIR/wqflask
+    cmd=$2
     echo PYTHONPATH=$PYTHONPATH
-    echo RUNNING COMMAND gunicorn $cmd
+    echo RUNNING gunicorn $cmd
     gunicorn $cmd
-    exit 0
+    exit $?
 fi
 
 echo "Starting the redis server:"