Ping Render Service #4103
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ping Render Service | |
on: | |
schedule: | |
- cron: "*/5 * * * *" # Runs every 15 minutes | |
jobs: | |
ping_service: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up the script | |
run: | | |
#!/bin/bash | |
# Fetch the Render URL from GitHub Secrets | |
RENDER_URL="${{ secrets.RENDER_URL }}" | |
# Function to ping the service and log the result | |
ping_service() { | |
echo "$(date) - Sending request to $RENDER_URL" | |
HTTP_RESPONSE=$(curl -I "$RENDER_URL" -s -o /dev/null -w "%{http_code}") | |
if [ "$HTTP_RESPONSE" -eq 200 ]; then | |
echo "$(date) - Successfully pinged $RENDER_URL, HTTP $HTTP_RESPONSE" >> ~/ping_log.txt | |
else | |
echo "$(date) - Failed to ping $RENDER_URL, HTTP $HTTP_RESPONSE" >> ~/ping_log.txt | |
fi | |
} | |
# Run the ping twice with a 10-minute delay, then stop | |
ping_service | |
# sleep 600 # Wait 600 seconds (10 minutes) | |
# ping_service |