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