Skip to content

Instantly share code, notes, and snippets.

@srgrn
Created May 8, 2016 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srgrn/ff5c08a2cebe7ff8e280aff6511d6310 to your computer and use it in GitHub Desktop.
Save srgrn/ff5c08a2cebe7ff8e280aff6511d6310 to your computer and use it in GitHub Desktop.
simple python runner that runs a python script in a given virtual env for cron
VIRTUALENV=$1
SCRIPT=$2
PARAMS="${@:3}"
source $VIRTUALENV/bin/activate
if [ -f $(dirname $SCRIPT)/requirements.txt ]
then
pip install -r $(dirname $SCRIPT)/requirements.txt
fi
python $SCRIPT $PARAMS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment