diff --git a/src/tools/scripts/deploy.sh b/src/tools/scripts/deploy.sh index def95324b3e..4d3610a4369 100755 --- a/src/tools/scripts/deploy.sh +++ b/src/tools/scripts/deploy.sh @@ -64,6 +64,11 @@ function check_continue { fi } +if [ ! "$(which pgrep)" ]; then + echo "Need pgrep installed. Try 'brew install proctools'" + exit 1 +fi + echo "Beginning the Web Almanac deployment process" # This script must be run from src directory @@ -95,7 +100,7 @@ git status git pull git pull origin main -if [ "$(pgrep -f 'python main.py')" ]; then +if [ "$(pgrep -if 'python main.py')" ]; then echo "Killing existing server to run a fresh version" pkill -9 python main.py fi @@ -192,7 +197,7 @@ git status echo "Checking out main branch" git checkout main -if [ "$(pgrep -f 'python main.py')" ]; then +if [ "$(pgrep -if 'python main.py')" ]; then echo "Killing server so backgrounded version isn't left there" pkill -9 -f "python main.py" fi diff --git a/src/tools/scripts/run_and_test_website.sh b/src/tools/scripts/run_and_test_website.sh index ec05f22f9d8..85c33f7592b 100755 --- a/src/tools/scripts/run_and_test_website.sh +++ b/src/tools/scripts/run_and_test_website.sh @@ -46,12 +46,17 @@ if [ -d "src" ]; then cd src fi -if [ "$(pgrep -f 'python main.py')" ]; then +if [ ! "$(which pgrep)" ]; then + echo "Need pgrep installed. Try 'brew install proctools'" + exit 1 +fi + +if [ "$(pgrep -if 'python main.py')" ]; then echo "Killing existing server to run a fresh version" pkill -9 -f "python main.py" fi -if [ "$(pgrep -f 'node ./tools/generate/chapter_watcher')" ]; then +if [ "$(pgrep -if 'node ./tools/generate/chapter_watcher')" ]; then echo "Killing existing watcher to run a fresh version" pkill -9 -f "node ./tools/generate/chapter_watcher" fi @@ -65,7 +70,7 @@ python main.py background & # Sleep for a couple of seconds to make sure server is up sleep 2 # Check website is running as won't have got feedback as backgrounded -pgrep -f "python main.py" +pgrep -if "python main.py" echo "Installing node modules" npm install @@ -98,7 +103,7 @@ if [ "${debug}" == "1" ]; then echo "Monitoring templates for changes" npm run watch & - if [ "$(pgrep -f 'python main.py')" ]; then + if [ "$(pgrep -if 'python main.py')" ]; then echo "Killing server to run a fresh version in debug mode" pkill -9 -f "python main.py" fi