PingWhipDashboard
Ingestion & APIs

cURL & Shell Integration Reference

Production-ready bash wrappers, crontab one-liners, and error traps.

Use robust curl flags to guarantee monitoring pings never block or crash running batch jobs:

  • -f: Fail silently on HTTP errors.
  • -s: Silent mode (no progress meter).
  • -S: Show error message if it fails.
  • -m 10: Max time of 10 seconds before timeout.
  • --retry 3: Retry transient network drops.

Universal Crontab One-Liner

0 2 * * * /usr/local/bin/backup.sh && curl -fsS -m 10 --retry 3 "https://ping.pingwhip.com/ping/<TOKEN>"

Full Error-Trapping Wrapper

#!/usr/bin/env bash
TOKEN="your_token_here"
START=$(date +%s%3N)

if OUTPUT=$(/path/to/job.sh 2>&1); then
  DUR=$(($(date +%s%3N) - START))
  curl -fsS -m 10 "https://ping.pingwhip.com/ping/$TOKEN?duration=$DUR"
else
  curl -fsS -m 10 -X POST "https://ping.pingwhip.com/ping/$TOKEN/fail" \
    --data-raw "$OUTPUT"
fi