PageRenderTime 17ms CodeModel.GetById 7ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/run.sh

https://bitbucket.org/cistrome/cistrome-harvard/
Shell | 79 lines | 69 code | 7 blank | 3 comment | 12 complexity | 143776f69a2b7657673439d43a10eec0 MD5 | raw file
 1#!/bin/sh
 2
 3cd `dirname $0`
 4
 5python ./scripts/check_python.py
 6[ $? -ne 0 ] && exit 1
 7
 8SAMPLES="
 9    community_wsgi.ini.sample
10    datatypes_conf.xml.sample
11    external_service_types_conf.xml.sample
12    migrated_tools_conf.xml.sample
13    reports_wsgi.ini.sample
14    shed_tool_conf.xml.sample
15    tool_conf.xml.sample
16    shed_tool_data_table_conf.xml.sample
17    tool_data_table_conf.xml.sample
18    tool_sheds_conf.xml.sample
19    data_manager_conf.xml.sample
20    shed_data_manager_conf.xml.sample
21    openid_conf.xml.sample
22    universe_wsgi.ini.sample
23    tool-data/shared/ncbi/builds.txt.sample
24    tool-data/shared/ensembl/builds.txt.sample
25    tool-data/shared/ucsc/builds.txt.sample
26    tool-data/shared/ucsc/publicbuilds.txt.sample
27    tool-data/shared/ucsc/ucsc_build_sites.txt.sample
28    tool-data/shared/igv/igv_build_sites.txt.sample
29    tool-data/shared/rviewer/rviewer_build_sites.txt.sample
30    tool-data/*.sample
31    static/welcome.html.sample
32"
33
34# Create any missing config/location files
35for sample in $SAMPLES; do
36    file=`echo $sample | sed -e 's/\.sample$//'`
37    if [ ! -f "$file" -a -f "$sample" ]; then
38        echo "Initializing $file from `basename $sample`"
39        cp $sample $file
40    fi
41done
42
43if [ -n "$GALAXY_UNIVERSE_CONFIG_DIR" ]; then
44    python ./scripts/build_universe_config.py "$GALAXY_UNIVERSE_CONFIG_DIR"
45fi
46
47# explicitly attempt to fetch eggs before running
48FETCH_EGGS=1
49for arg in "$@"; do
50    [ "$arg" = "--stop-daemon" ] && FETCH_EGGS=0; break
51done
52if [ $FETCH_EGGS -eq 1 ]; then
53    python ./scripts/check_eggs.py -q
54    if [ $? -ne 0 ]; then
55        echo "Some eggs are out of date, attempting to fetch..."
56        python ./scripts/fetch_eggs.py
57        if [ $? -eq 0 ]; then
58            echo "Fetch successful."
59        else
60            echo "Fetch failed."
61            exit 1
62        fi
63    fi
64fi
65
66if [ -n "$GALAXY_RUN_ALL" ]; then
67    servers=`sed -n 's/^\[server:\(.*\)\]/\1/  p' universe_wsgi.ini | xargs echo`
68    daemon=`echo "$@" | grep -q daemon`
69    if [ $? -ne 0 ]; then
70        echo 'ERROR: $GALAXY_RUN_ALL cannot be used without the `--daemon` or `--stop-daemon` arguments to run.sh'
71        exit 1
72    fi
73    for server in $servers; do
74        echo "Handling $server with log file $server.log..."
75        python ./scripts/paster.py serve universe_wsgi.ini --server-name=$server --pid-file=$server.pid --log-file=$server.log $@
76    done
77else
78    python ./scripts/paster.py serve universe_wsgi.ini $@
79fi