Skip to content

HTTP uptime check via bash + cron

Ensure your site returns 2xx every minute, alert to Slack/Telegram on failure.

Recipe

bash
#!/usr/bin/env bash
# /etc/cron.d/uptime-check
# * * * * * root /opt/uptime.sh https://example.com

URL="${1:?URL required}"
CODE=$(curl -o /dev/null -s -w "%{http_code}" -m 10 "$URL")
[ "$CODE" -ge 200 ] && [ "$CODE" -lt 400 ] || \
  curl -X POST "$SLACK_WEBHOOK" --data "{\"text\":\"$URL → $CODE\"}"

Same thing in Enterno.io

Alternatively, Enterno tracks HTTP response + latency from 3 regions without Bash or webhooks — add the URL to monitors.

Set up HTTP monitor → ← All recipes