#!/bin/sh -eux

# USAGE: run.sh /path/to/virtualenv

THIS_SCRIPT=$0
THIS_DIR=$(dirname ${THIS_SCRIPT})

VENV_BASE_DIR=${1}

. ${THIS_DIR}/get_virtualenv_from_requirements_file.sh

activate_virtualenv() {
    VIRTUALENV=$(get_virtualenv_from_requirements_file ${VENV_BASE_DIR})
    set +u
    . ${VIRTUALENV}/bin/activate
    set -u
}

run_webapp() {
    ${THIS_DIR}/../app/main.py
}


activate_virtualenv
run_webapp

#!/bin/sh -eux

# USAGE: run.sh /path/to/virtualenv

THIS_SCRIPT=$0
THIS_DIR=$(dirname ${THIS_SCRIPT})

VENV_BASE_DIR=${1}

. ${THIS_DIR}/get_virtualenv_from_requirements_file.sh

activate_virtualenv() {
    VIRTUALENV=$(get_virtualenv_from_requirements_file ${VENV_BASE_DIR})
    set +u
    . ${VIRTUALENV}/bin/activate
    set -u
}

run_webapp() {
    exec ${THIS_DIR}/../app/main.py
}


activate_virtualenv
run_webapp

Allow supervisor to kill the process
Allow supervisor to kill the process

Use `exec` in the run script to kick off python, otherwise supervisor
can only kill the wrapper script.

See http://stackoverflow.com/a/27058309
