Skip to content

Commit

Permalink
fixup! [ADD] gh-action for CI/CD on master branch push
Browse files Browse the repository at this point in the history
  • Loading branch information
maschlr committed Aug 22, 2024
1 parent 92bb9ff commit 1a7d716
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions .github/workflows/ssh-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,12 @@ jobs:
REPO_PATH: ${{ secrets.REPO_PATH }}
run: |
ssh -i ~/.ssh/deploy_key -o IdentitiesOnly=yes $USER@$HOST << EOF
# Function to check if the process is running
is_process_running() {
pgrep -f "python bot.py" > /dev/null
return $?
}
# Send Ctrl+C to gracefully stop the process
screen -S $SCREEN_SESSION -X stuff $'\003'
timeout=60 # Maximum wait time in seconds
counter=0
while is_process_running && [ $counter -lt $timeout ]; do
sleep 1
counter=$((counter + 1))
done
# Check if the process is still running after timeout
if is_process_running; then
echo "Failed to terminate the process within $timeout seconds."
exit 1
fi
# Wait for the process to stop
sleep 2
# Pull latest changes
cd $REPO_PATH
Expand Down

0 comments on commit 1a7d716

Please sign in to comment.