diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/genenetwork2 | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/bin/genenetwork2 b/bin/genenetwork2 new file mode 100755 index 00000000..bbb2a19f --- /dev/null +++ b/bin/genenetwork2 @@ -0,0 +1,44 @@ +#! /bin/bash +# +# This will run the GN2 server (with default settings if none supplied). +# +# Environment settings can be used to preconfigure as well as a +# settings.py file. + +# Absolute path to this script, e.g. /home/user/bin/foo.sh +SCRIPT=$(readlink -f "$0") +# Absolute path this script is in, thus /home/user/bin +GN2_BASE_PATH=$(dirname $(dirname "$SCRIPT")) + +GN2_GUIX_PATH=$GN2_BASE_PATH/lib/python2.7/site-packages/genenetwork2-2.0-py2.7.egg +if [ -d $GN2_GUIX_PATH ]; then + GN2_BASE_PATH=$GN2_GUIX_PATH +fi +echo $GN2_BASE_PATH + +# Handle settings parameter +settings=$1 +if [ -z $settings ]; then settings=$GN2_BASE_PATH/etc/default_settings.py ; fi +if [ ! -e $settings ]; then + echo "ERROR: can not locate settings file - pass it in the command line" + exit 1 +fi +export WQFLASK_SETTINGS=$settings + +# We may change this one: +export PYTHONPATH=$GN2_BASE_PATH/wqflask:$PYTHONPATH + +# TEMPDIR defaults to /tmp if nothing else +if [ -z $TEMPDIR ]; then + TEMPDIR="/tmp" +fi + +# Start the redis server +echo -n "dir $TEMPDIR +dbfilename gn2.rdb +" | redis-server - & + +# Start the flask server running GN2 +cd $GN2_BASE_PATH/wqflask +echo "Starting with $settings" +/usr/bin/env python runserver.py |