Skip to content

Automatic retries

Set retry to restart a daemon after a failure. The default is no retries.

toml
[daemons.api]
run = "node server.js"
ready_http = { url = "http://127.0.0.1:3000/health", timeout = "30s" }
retry = 3

This allows the initial attempt plus three retries. It applies to startup failures and errors after startup, including termination caused by health checks or resource limits.

Choose a policy

ValueBehavior
0 or falseDo not retry (default)
A positive integerRetry up to that many times
trueKeep retrying on failure until stopped or disabled
toml
[daemons.worker]
run = "python3 worker.py"
retry = true

Retries respond to failures. A process that completes successfully is not a crashed service; use cron to repeat a successful task.

Startup failures versus runtime failures

When it failsWho handles the retryTiming
Before becoming readyThe startup operationExponential backoff: 1s, 2s, 4s, …
After becoming readyThe supervisor in the backgroundEvaluated on interval ticks (general.interval, default 10s)

During startup retries, the CLI keeps waiting until readiness or failure. Runtime retries happen independently of the terminal that started the daemon. Use depends and ready checks to handle startup ordering instead of relying on failures to delay a dependent service.

One-off commands

pitchfork run accepts a retry count:

sh
pitchfork run worker --retry 3 -- ./worker

For pitchfork start, configure retry in pitchfork.toml; it has no --retry override. You can also save a new daemon with a retry policy:

sh
pitchfork daemons add worker --run './worker' --retry 3

Inspect or interrupt retries

sh
pitchfork status api
pitchfork logs api --tail
pitchfork stop api

To prevent later manual or automatic starts, use pitchfork disable api. Restore it with pitchfork enable api.

Use on_retry to react to each retry and on_fail when attempts are exhausted. See lifecycle hooks.

MIT LicenseCopyright © 2026jdx.dev