aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2018-01-31 11:22:42 +0000
committerPjotr Prins2018-01-31 11:22:42 +0000
commitc38cf0af74c3927f5b7d1da5416671f14c789f72 (patch)
tree6bfc033391d50f6ee21a2c271a7be7aa708800f6
parentf60d49527bedfc1ecda401f49fae9c9a5bbcf5f9 (diff)
downloadgenenetwork2-c38cf0af74c3927f5b7d1da5416671f14c789f72.tar.gz
Startup: added -cli option
-rwxr-xr-xbin/genenetwork220
1 files changed, 18 insertions, 2 deletions
diff --git a/bin/genenetwork2 b/bin/genenetwork2
index cbaba76f..65330ec8 100755
--- a/bin/genenetwork2
+++ b/bin/genenetwork2
@@ -1,8 +1,11 @@
#! /bin/bash
#
+# This is the startup script for GN2. It sets the environment variables to pick
+# up a Guix profile and allows for overriding parameters.
+#
# Typical usage
#
-# env GN2_PROFILE=~/opt/genenetwork2-phewas ./bin/genenetwork2
+# env GN2_PROFILE=~/opt/genenetwork2-phewas ./bin/genenetwork2 ~/my_settings.py
#
# Where GN2_PROFILE points to the GNU Guix profile used for deployment.
#
@@ -41,6 +44,7 @@
# env GN2_PROFILE=~/opt/gn-latest-guix ./bin/genenetwork2 ./etc/default_settings.py -gunicorn "--bind 0.0.0.0:5003 --workers=1 wsgi"
SCRIPT=$(realpath "$0")
+echo SCRIPT=$SCRIPT
GN2_BASE_DIR=$(dirname $(dirname "$SCRIPT"))
GN2_ID=$(cat /etc/hostname):$(basename $GN2_BASE_DIR)
@@ -96,6 +100,8 @@ if [ -z $GN2_PROFILE ] ; then
if [ -d $GN2_PROFILE ]; then
echo "Best guess is $GN2_PROFILE"
fi
+ echo "ERROR: always set GN2_PROFILE"
+ exit 1
fi
if [ -z $GN2_PROFILE ]; then
read -p "PRESS [ENTER] TO CONTINUE..."
@@ -143,7 +149,7 @@ set|grep guix
set|grep $GN2_PROFILE
set|grep TMPDIR
-# Now handle command parameter -c
+# Now handle command parameter -c which runs python
if [ "$1" = '-c' ] ; then
cd $GN2_BASE_DIR/wqflask
cmd=${2#wqflask/}
@@ -152,6 +158,16 @@ if [ "$1" = '-c' ] ; then
python $cmd
exit $?
fi
+# Now handle command parameter -cli which runs in bash
+if [ "$1" = "-cli" ] ; then
+ echo "HERE"
+ cd $GN2_BASE_DIR/wqflask
+ cmd=$2
+ echo PYTHONPATH=$PYTHONPATH
+ echo RUNNING COMMAND $cmd
+ $cmd
+ exit $?
+fi
if [ "$1" = '-gunicorn' ] ; then
cd $GN2_BASE_DIR/wqflask
cmd=$2