From 23a557a423f17597f98015d5b9f5dac175c8c8c3 Mon Sep 17 00:00:00 2001 From: varsha1305nav <87652813+varsha1305nav@users.noreply.github.com> Date: Thu, 4 Apr 2024 12:41:36 +0530 Subject: [PATCH] adding commands to kill previous processes --- .github/workflows/deploy_prod_api.yml | 23 ++++++++++++++++++++++- .github/workflows/deploy_prod_ui.yml | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy_prod_api.yml b/.github/workflows/deploy_prod_api.yml index 7c3f415e..2c2da66f 100644 --- a/.github/workflows/deploy_prod_api.yml +++ b/.github/workflows/deploy_prod_api.yml @@ -30,7 +30,7 @@ jobs: host: ${{ secrets.PRODSERVER_API }} username: ${{ secrets.USERNAME_PROD }} key: ${{ secrets.SECRETKEY_PROD }} - command_timeout: 10m + command_timeout: 5m script: | cd xfluencer/influencer-marketplace pwd @@ -41,6 +41,27 @@ jobs: pip3 install -r requirements.txt python3 manage.py migrate python3 manage.py collectstatic -link --noinput + echo "Stopping previous processes..." + # Get the PID of the processes + celery_pid=$(pgrep -f "celery worker") + beat_pid=$(pgrep -f "beat") + marketplace_pid=$(pgrep -f "marketplace") + + # Check if the PID is non-empty and kill the processes + if [ -n "$celery_pid" ]; then + kill $celery_pid + echo "Celery worker process with PID $celery_pid killed." + fi + + if [ -n "$beat_pid" ]; then + kill $beat_pid + echo "Beat process with PID $beat_pid killed." + fi + + if [ -n "$marketplace_pid" ]; then + kill $marketplace_pid + echo "Marketplace process with PID $marketplace_pid killed." + fi echo "Stopping redis service..." sudo systemctl stop redis echo "Starting redis service..." diff --git a/.github/workflows/deploy_prod_ui.yml b/.github/workflows/deploy_prod_ui.yml index f0317a6a..e746c044 100644 --- a/.github/workflows/deploy_prod_ui.yml +++ b/.github/workflows/deploy_prod_ui.yml @@ -30,7 +30,7 @@ jobs: host: ${{ secrets.PRODSERVER_UI }} username: ${{ secrets.USERNAME_PROD }} key: ${{ secrets.SECRETKEY_PROD }} - command_timeout: 10m + command_timeout: 5m script: | cd xfluencer/influencer-marketplace git pull