Skip to content

Check server status #4191

Check server status

Check server status #4191

Workflow file for this run

name: Check server status
on:
schedule:
- cron: '*/15 * * * *' # Run every 15 minutes
workflow_dispatch:
jobs:
cron_job:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# Add your job steps here
- name: Ping the server and log the uptime
run: |
now=$(TZ=US/Eastern date -Iseconds)
httpCode=$(curl -s -o /dev/null -w "%{http_code}" https://18f.gsa.gov)
statusText=$([[ $httpCode -eq 200 || $httpCode -eq 302 ]] && echo "up" || echo "dn")
echo "$now | $httpCode | $statusText" >> log.txt
tail -n 65 log.txt > readlog.txt
- uses: EndBug/add-and-commit@v9
with:
message: Add uptime check
default_author: github_actions
committer_name: GitHub Actions
committer_email: actions@github.com