cron guide

Monitor a Linux cron job with Verifagent

Cron is the most common server schedule. Append a Verifagent call after the job command so silence means the job never ran or failed before the ping.

Before you start

Create a monitor with your workflow’s real frequency, then copy its URL from the dashboard. Its token is secret: do not publish it.

Module to use : crontab + curl. Place it after the last useful action on the success path.

Setup

1

Copy the monitor URL

Create a monitor whose expected period matches the crontab schedule (for example every day at 03:15 → 24h period). Copy the ping URL from the dashboard.

https://verifagent.com/api/ping/your-ping-token
2

Chain the real command with &&

Edit crontab with crontab -e. Put the business command first, then && curl so the ping runs only if the command exits 0. A leading ping would lie about success.

# Every day at 03:15 — replace the script path and URL 15 3 * * * /usr/local/bin/backup.sh && curl -fsS "https://verifagent.com/api/ping/your-ping-token"
3

Use an absolute PATH and a full curl path if needed

Cron starts with a minimal environment. Prefer absolute paths for binaries and scripts. If curl is missing from PATH, call /usr/bin/curl explicitly.

# Minimal env trap: set PATH or use absolute paths PATH=/usr/local/bin:/usr/bin:/bin 15 3 * * * /usr/local/bin/backup.sh && /usr/bin/curl -fsS "https://verifagent.com/api/ping/your-ping-token"
4

Test outside cron first

Run the same chained command in your shell once. You should see HTTP 200 and {"ok":true}. Then wait for the next cron tick or force a run.

/usr/local/bin/backup.sh && curl -fsS "https://verifagent.com/api/ping/your-ping-token"
Always ping after success (&&), never before. Set expected period to the crontab interval and grace slightly above worst-case runtime plus clock skew (often 5–15 minutes).

Available routes

The base URL is enough for a heartbeat. Variants enrich history if your platform has several branches.

GET https://YOUR_PING_URL
POST https://YOUR_PING_URL/success
POST https://YOUR_PING_URL/fail?msg=Error

Verify

After a successful chained run, open the monitor: status becomes Up. Temporarily break the command (false && curl …) and confirm no new ping arrives until you fix it.

Expected response: 200 {"ok":true}. The monitor moves from Pending to Up.