October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Cron

How to Monitor a Website with a Curl Script (with Cron Alerts)

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A reliable curl monitor is a small shell program that makes one bounded HTTP request, checks explicit health rules, records status and timing, and exits nonzero when the site fails. A scheduler such as cron can run it every few minutes, while cron mail, a paging wrapper, or a heartbeat service turns that exit code into an alert.

What a curl website monitor should check

“Curl returned output” is not a health check. Define success before writing the command:

  • The request connects before a connection deadline.
  • The complete operation finishes before a total deadline.
  • The final HTTP status, after any intended redirects, is accepted.
  • The response time is below your service-level threshold.
  • For a deterministic health endpoint, the body contains an invariant marker.
  • TLS certificate validation remains enabled.

Use a small /health or /ready endpoint when possible. Avoid exact-string tests on personalized home pages, where content changes by cookie, location, or account.

A production-ready POSIX shell script

Save this as /usr/local/bin/check-site.sh and make it executable with chmod 755 /usr/local/bin/check-site.sh:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
  • Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
  • Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
  • CanaKit Turbine Black Case for the Raspberry Pi 5
  • CanaKit Low Noise Bearing System Fan
  • Mega Heat Sink - Black Anodized
#!/usr/bin/env sh
set -eu

url="https://example.com/health"
max_time=15
tmp="$(mktemp)"
trap 'rm -f "$tmp"' EXIT

result=$(curl --silent --show-error --location 
  --connect-timeout 5 --max-time "$max_time" 
  --output "$tmp" 
  --write-out '%{http_code} %{time_total}' 
  "$url") || {
  printf '%s transport failure: %sn' "$(date -u +%FT%TZ)" "$url" >&2
  exit 1
}

http_code=${result% *}
time_total=${result#* }

if [ "$http_code" -lt 200 ] || [ "$http_code" -ge 400 ]; then
  printf '%s HTTP %s in %ss: %sn' "$(date -u +%FT%TZ)" "$http_code" "$time_total" "$url" >&2
  exit 1
fi

printf '%s OK HTTP %s in %ss: %sn' "$(date -u +%FT%TZ)" "$http_code" "$time_total" "$url"

The script follows redirects, stores the body in a temporary file instead of printing it, and emits the final status and total duration. A DNS error, refused connection, TLS failure, or timeout enters the transport-failure branch. A 404 or 500 produces an HTTP failure with its status visible to operators.

Adding a body-marker test

Only add this for stable, non-personalized content. For example, after parsing time_total, add:

if ! grep -Fq 'status: ok' "$tmp"; then
  printf '%s body marker missing: %sn' "$(date -u +%FT%TZ)" "$url" >&2
  exit 1
fi

Do not put passwords, authorization headers, or response bodies into ordinary logs. Keep credentials in protected environment variables or a secret manager and send only the minimum headers required.

HEAD or GET: choose deliberately

Use HEAD for a cheap availability check

curl --head https://example.com asks for headers only, so it avoids downloading the response body. It is efficient for servers that implement HEAD correctly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use GET when content matters

Some servers deny HEAD while allowing GET. Use the script’s GET request when you need to verify a marker, exercise application code, or support endpoints with incomplete HEAD implementations. Keep --output pointed at a file so a large page does not flood a terminal or cron mail.

Rank #2
CanaKit Raspberry Pi 4 4GB Starter PRO Kit - 4GB RAM
  • Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM)
  • Includes Pre-Loaded 32GB EVO+ Micro SD Card (Class 10), USB MicroSD Card Reader
  • CanaKit Premium High-Gloss Raspberry Pi 4 Case with Integrated Fan Mount, CanaKit Low Noise Bearing System Fan
  • CanaKit 3.5A USB-C Raspberry Pi 4 Power Supply (US Plug) with Noise Filter, Set of Heat Sinks, Display Cable - 6 foot (Supports up to 4K60p)
  • CanaKit USB-C PiSwitch (On/Off Power Switch for Raspberry Pi 4)

Redirect behavior

--location follows redirects and reports the final response. Keep it when the destination is part of the intended check; remove it when a redirect itself indicates misconfiguration. Always decide whether HTTP-to-HTTPS redirects, login redirects, and cross-host redirects are success or failure for your service.

Timeouts, slow transfers, and curl exit codes

--connect-timeout 5 bounds connection establishment. --max-time 15 bounds the entire request, including redirects and body transfer. Set both: a connection can succeed while an application hangs indefinitely.

For endpoints that trickle data too slowly, add a transfer-rate guard:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl --silent --show-error --location 
  --connect-timeout 5 --max-time 30 
  --speed-limit 1024 --speed-time 10 
  --output /tmp/health-body "$url"

The speed options abort a transfer that remains below the chosen rate for the chosen interval. Tune them to your endpoint rather than applying them to every download.

--fail makes HTTP responses outside curl’s success range fail the command and suppresses the body. It is useful for one-off checks, but a monitor should still capture %{http_code}; distinguishing a 404 from DNS, TLS, and timeout failures makes remediation faster. The script above therefore evaluates the status explicitly instead of relying only on --fail.

Rank #3
ELECROW CrowPi Case Kit for Raspberry Pi 5, 9-Inch Display
  • Not including the Raspberry Pi 5 (8GB), the Crowpi advanced version comes with the Raspberry Pi 5
  • ELECROW Black Case for the Raspberry Pi 5, CrowPi is equipped with a 9-inch HD touchscreen along with a camera; All the regular components used in DIY electronics are packed into the CrowPi development board, such as LCD, LED matrix, buzzer, light sensor, PIR sensor, ultrasonic sensor, IR sensor, etc
  • Raspberry Pi Sensors: The Crowpi raspberry pi 5 programming kit is jam-packed with lots of buttons such as 19 different sensors in a tidy easy to use package; You don't have to wait and wire things
  • Build Quality: Solid ABS shell and well made components in one place make it strong and convenient to travel
  • Programming Lessons: This raspberry pi 5 learning kit ships with step by step instructions and provides 21 lessons to take you through identifying components reading code and running it in the terminal

Logging useful evidence

Log UTC timestamp, URL or check name, final status, elapsed time, and a failure class. A compact success line looks like:

2026-09-30T12:00:00Z OK HTTP 200 in 0.184s: https://example.com/health

Rotate logs or send them to your system journal. Never log query strings or headers that contain tokens. If a check has warning and critical latency thresholds, keep those thresholds separate from the hard timeout: a 2-second warning can identify degradation while a 15-second timeout determines outright failure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run the check from cron

Install this crontab entry with crontab -e:

*/5 * * * * /usr/local/bin/check-site.sh >>/var/log/check-site.log 2>&1

Cron runs with a limited environment. Use absolute paths, set any required environment variables in a protected file, and verify that the cron user can execute curl, write the log, and create temporary files.

Making failures alert someone

  • Cron can email command output when configured on the host.
  • A wrapper can send a notification only when the script exits nonzero.
  • A heartbeat endpoint can receive a success ping; missing pings then trigger an alert.
  • A systemd timer can replace cron when you need service dependencies, journal integration, or randomized scheduling.

Test the failure path intentionally with a disposable URL or a deliberately blocked port. Confirm that the command exits 1, produces a useful line, and reaches the alert channel.

Local script or hosted monitoring?

Consideration Local curl script Hosted monitor
Detection HEAD or GET rules you control Provider-defined HTTP checks and options
Scheduling Your cron or systemd timer Provider-managed schedule
vantage points Usually one machine and network May run from independent external locations
History Your log retention Often includes retained check history
Alerts You build mail, paging, or heartbeat integration Notification routing is typically built in
Cost and control Transparent and inexpensive; you operate it Operational features in exchange for service dependency and subscription cost

A local check can miss an outage that affects only users outside your network. A hosted check cannot validate private localhost services unless you provide a secure reachable endpoint or an agent. Compare authentication support, redirect and TLS controls, latency thresholds, log retention, and alert behavior before moving.

Rank #4
CanaKit Raspberry Pi 5 Desktop PC with SSD (Fully Assembled) (256 GB SSD)
  • Fully assembled for plug-and-play operation
  • Includes Raspberry Pi 5 with 8GB RAM
  • 256 GB PCIe Pi NVMe SSD (Pre-loaded with Pi 64-Bit OS)
  • M.2 HAT+
  • CanaKit Turbine Black Case for the Pi 5
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

HTTP 404, 401, or 500

Inspect the final URL and status. A 401 may be expected for a protected endpoint; configure the minimum required authentication rather than marking every 4xx as healthy. A 500 usually indicates an application or upstream failure. Adjust the accepted range only when the endpoint contract explicitly allows it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

HEAD returns 405 or 403

Switch to GET with --output. Do not treat a rejected HEAD as proof that the site is down.

Timeouts

Use verbose mode on a manual run to identify DNS, connection, TLS, redirect, or transfer delay:

curl --verbose --connect-timeout 5 --max-time 15 https://example.com/health

Keep certificate verification enabled. Increasing the timeout can hide a regression; first determine which phase is slow.

Redirect loops or unexpected login pages

Run without --location to inspect the first response, then decide whether the redirect target is part of the check. Authenticated checks should use a dedicated health endpoint, not an interactive login flow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
RasTech Raspberry Pi 5 8GB Kit with Active Cooler and Pi5 Case
  • 【What you Get】You will get 1*Pi 5 8GB Single Board,1*RasTech Case,1*Active Cooler,1*Screwdriver,1*Installation instructions,12-month free warranty, lifetime service, 24-hour prompt and friendly response.
  • 【More Connectors】There are two USB 3.0 ports(5Gbps simultaneously) and two USB 2.0 ports, which triple total bandwidth ,support any combination of up to two cameras or displays. Peak SD card performance is doubled through support for the SDR104 high-speed mode. It provides a smooth desktop experience for you. Offer Gigabit Ethernet and a PCIe interface, along with dual-band Wi-Fi and Bluetooth 5.0/BLE wireless capability. The RasTech Pi 5 Kit use the new 27W 5.1V 5A USB-C power connector.
  • 【 Support Dual 4Kp60 Display 】Each of the two microHDMI sockets can control a 4K display at 60 Hertz, now support HDR, offering super HD video for media streaming projects. RPi 5 is the first RPi model that comes with a PCI Express port (PCIe 2.0 x1 with 500 MB/s) to attach SSDs (requires separate M.2 HAT).
  • 【 Excellent Chips And Applications】Pi 5 is a full-size Pi computer using silicon built in-house at Pi. The RP1 “southbridge” provides the bulk of the I/O capabilities for Pi 5. Pi 5 is more friendly and convenient in the development of Internet of Things, Web development, machine identification, automatic control and other electronic equipment applications and network.
  • 【 Faster CPU, Better GPU 】 Pi 5 features a Broadcom BCM2712 64-bit quad-core Arm Cortex-A76 processor running at 2.4GHz, it delivers a 2–3× increase in CPU performance relative to RaspberryPi 4. The 800MHz VideoCore VII GPU is compatible to OpenGL ES 3.1 and Vulkan 1.2, substantial uplift in graphics performance. Pi 5 Offers lightning-fast CPU speed, a PCI Express interface, a Real Time Clock (RTC) and a power button and runs significantly cooler than Pi 4.

Works interactively but fails in cron

Check absolute command paths, file permissions, working-directory assumptions, proxy variables, DNS configuration, and the cron user’s certificate store. Capture stderr in the cron log while diagnosing, then remove sensitive details.

Or skip the browser setup

If your goal is a screenshot-based check or visual record rather than a raw HTTP health probe, ScreenshotNeo provides a single GET request and an MCP server for AI agents. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing result in headers.

See the ScreenshotNeo API documentation for all options. A curl call is:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

You can also use Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Or Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo supports full-page and element captures, device and viewport settings, dark mode, retina scale, PDFs, custom CSS or JavaScript, clicks, waits, request blocking, headers, cookies, user agents, timezone and geolocation, caching, signed links, asynchronous jobs, bulk capture, usage reporting, and an OpenAPI specification. Its MCP tools are take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Practical checklist

  • Use a deterministic health endpoint.
  • Set both connection and total-operation timeouts.
  • Choose HEAD or GET based on server support and validation needs.
  • Follow redirects only when the final destination is intended.
  • Record status, duration, timestamp, and failure class.
  • Keep secrets out of command lines and logs where possible.
  • Make every failed condition exit nonzero.
  • Test cron and alert delivery with an intentional failure.
  • Move to external monitoring when you need independent locations, history, or managed notification workflows.

Frequently Asked Questions

Should I monitor a homepage or a health endpoint?

Prefer a small deterministic health endpoint; homepages often vary by cookie, account, and location.

What does a nonzero exit status mean?

It tells cron or an alert wrapper that a transport, timeout, HTTP-status, latency, or content rule failed.

Can curl verify TLS certificates?

Yes. Its normal certificate verification should remain enabled; investigate certificate failures instead of disabling verification.

Quick Recap

Bestseller No. 1
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM); CanaKit Turbine Black Case for the Raspberry Pi 5
$259.95
Bestseller No. 2
CanaKit Raspberry Pi 4 4GB Starter PRO Kit - 4GB RAM
CanaKit Raspberry Pi 4 4GB Starter PRO Kit - 4GB RAM
Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM); Includes Pre-Loaded 32GB EVO+ Micro SD Card (Class 10), USB MicroSD Card Reader
$159.99
Bestseller No. 4
CanaKit Raspberry Pi 5 Desktop PC with SSD (Fully Assembled) (256 GB SSD)
CanaKit Raspberry Pi 5 Desktop PC with SSD (Fully Assembled) (256 GB SSD)
Fully assembled for plug-and-play operation; Includes Raspberry Pi 5 with 8GB RAM; 256 GB PCIe Pi NVMe SSD (Pre-loaded with Pi 64-Bit OS)
$339.97

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.