ping Command
pakyas ping sends one ping. Use it when monitor doesn’t fit, for example when the start and end of a job happen in different steps.
# By slug, check ID, or public ID (needs an API key to resolve)pakyas ping <CHECK> [FLAGS]
# By public ID (no API key, no API calls)pakyas ping --public-id <UUID> [FLAGS]Slugs are resolved across the whole organization, using the local cache for up to an hour, or longer if the API can’t be reached. If no organization is configured, the CLI uses the organization of the API key, so PAKYAS_API_KEY=... pakyas ping <slug> works in CI. --public-id needs no key and makes no API calls, so it is the fastest and most robust option for cron and CI.
Examples
Section titled “Examples”pakyas ping backup-db # successpakyas ping backup-db --start # job startedpakyas ping backup-db --fail # job failedpakyas ping backup-db --exit-code 1 # report an exit code (0 = success)
pakyas ping --public-id 550e8400-e29b-41d4-a716-446655440000On success the CLI prints a confirmation such as ✓ Sent success ping for 'backup-db' and exits 0. If the ping fails, it exits non-zero: 3 if the check can’t be found, 4 if the ping endpoint is unreachable, rate limited or has a server error (retry), and 1 otherwise. See Exit Codes.
pakyas ping sends no body. To attach output to a ping, wrap the job with pakyas monitor, or POST the body yourself (Ping Endpoint). Pakyas keeps up to 5 KB (Free), 25 KB (Developer), 100 KB (Pro) or 250 KB (Business) of a ping body.
| Flag | Env var | Description |
|---|---|---|
--public-id <UUID> | PAKYAS_PUBLIC_ID | Check public ID. Skips authentication and slug resolution. |
--start | - | Send a start signal |
--fail | - | Send a fail signal |
--exit-code <N> | - | Send an exit code (0 = success, non-zero = fail) |
--run <ID> | - | Run identifier. Use the same value for the start ping and the completion ping to pair them. |
--duration-ms <MS> | - | Duration of the run in milliseconds, for completion pings |
--no-external | PAKYAS_NO_EXTERNAL | Don’t notify external monitors |
--external-timeout-ms <MS> | PAKYAS_EXTERNAL_TIMEOUT_MS | Timeout for each external monitor request (default 5000) |
--start, --fail, and --exit-code are mutually exclusive, and --duration-ms cannot be combined with --start. Conflicting flags are a usage error (exit code 2).
PAKYAS_PUBLIC_ID takes precedence over a slug argument.
External monitors configured in external_monitors.toml (or through EXTERNAL_WEBHOOK_URL) are notified after a successful Pakyas ping. The inline --healthchecks-id, --cronitor-key, and --webhook-url flags are only available on monitor.
Use Cases
Section titled “Use Cases”Manual Testing
Section titled “Manual Testing”pakyas ping test-check --startsleep 5pakyas ping test-checkScripted Pings
Section titled “Scripted Pings”#!/bin/shpakyas ping my-job --start
if ./step-one.sh && ./step-two.sh; then pakyas ping my-jobelse pakyas ping my-job --failfiPairing Start and End with a Run ID
Section titled “Pairing Start and End with a Run ID”If runs can overlap, give each run its own ID so Pakyas matches each finish with the right start:
#!/bin/shRUN_ID=$(uuidgen)pakyas ping my-job --start --run "$RUN_ID"
./my-job.shpakyas ping my-job --exit-code $? --run "$RUN_ID"Reporting an Exact Duration
Section titled “Reporting an Exact Duration”--duration-ms sends the duration you measured. date +%s%3N prints milliseconds with GNU date (Linux) but not with the BSD date on macOS, so this example uses Perl, which is available on both:
#!/bin/shnow_ms() { perl -MTime::HiRes=time -e 'printf "%d\n", time * 1000'; }
pakyas ping my-job --startSTART=$(now_ms)
./my-complex-job.shSTATUS=$?
pakyas ping my-job --exit-code "$STATUS" --duration-ms $(( $(now_ms) - START ))pakyas monitor measures and sends the duration for you.
See Also
Section titled “See Also”- monitor - Wrap a command with automatic pings
- Ping Endpoint - Ping over HTTP without the CLI
- CLI Configuration - CI and cron setup