Skip to content

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.

Terminal window
# 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.

Terminal window
pakyas ping backup-db # success
pakyas ping backup-db --start # job started
pakyas ping backup-db --fail # job failed
pakyas ping backup-db --exit-code 1 # report an exit code (0 = success)
pakyas ping --public-id 550e8400-e29b-41d4-a716-446655440000

On 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.

FlagEnv varDescription
--public-id <UUID>PAKYAS_PUBLIC_IDCheck 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-externalPAKYAS_NO_EXTERNALDon’t notify external monitors
--external-timeout-ms <MS>PAKYAS_EXTERNAL_TIMEOUT_MSTimeout 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.

Terminal window
pakyas ping test-check --start
sleep 5
pakyas ping test-check
#!/bin/sh
pakyas ping my-job --start
if ./step-one.sh && ./step-two.sh; then
pakyas ping my-job
else
pakyas ping my-job --fail
fi

If runs can overlap, give each run its own ID so Pakyas matches each finish with the right start:

#!/bin/sh
RUN_ID=$(uuidgen)
pakyas ping my-job --start --run "$RUN_ID"
./my-job.sh
pakyas ping my-job --exit-code $? --run "$RUN_ID"

--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/sh
now_ms() { perl -MTime::HiRes=time -e 'printf "%d\n", time * 1000'; }
pakyas ping my-job --start
START=$(now_ms)
./my-complex-job.sh
STATUS=$?
pakyas ping my-job --exit-code "$STATUS" --duration-ms $(( $(now_ms) - START ))

pakyas monitor measures and sends the duration for you.