1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/bin/sh cd $WORKSPACE export PY= /usr/local/bin/python3 export FLASK_RUN_PORT=4005 $PY -m pip install pipenv $PY -m pipenv install --dev export VENV_HOME_DIR=$($PY -m pipenv --venv) source $VENV_HOME_DIR /bin/activate flask db upgrade flask populate-initial-data export BUILD_ID=XYZapi $WORKSPACE /killlastbuild .sh flask run & deactivate |
killlastbuild.sh can have anything inside it depending upon your project requirements. I put 2 process killers to kill background-ed daemon processes from previous build command
1 2 | ps -Af | grep "xyzapi" | grep - v grep | awk '{print$2}' | head -1 | xargs kill -9 ps -Af | grep "xyzapi" | grep - v grep | awk '{print$2}' | head -1 | xargs kill -9 |
Leave a Reply