Why didn’t my cron job run? Trace a scheduled job on Gregale
Find whether a cron was skipped, queued, or failed in the app. Use Gregale occurrence history, run outcomes, and a manual check after a fix.
If your cron job did not run on Gregale, check its scheduled occurrences before checking application logs. A scheduled occurrence says what the scheduler decided about a particular time. Run history says what happened to an execution that started. An overlap skip is not a failed app request, and a failed request is not proof that the schedule was missed.
| What you see | Where to look | What to do next |
|---|---|---|
| No execution at the expected time | gregale cron get, then gregale cron occurrences | Check the expression, timezone, whether the cron is enabled, and any recorded skip or hold. |
| A scheduled time was skipped while the previous run was active | gregale cron occurrences | Check how long the earlier work takes. Raise the interval or keep skipping overlapping work if running twice is unsafe. |
| An execution reports an HTTP error or timeout | gregale cron runs | Check the handler for the configured path and inspect the app logs. Gregale sends POST, not GET. |
| The handler works now, but a scheduled run is still missing | gregale cron run ID --wait for a safe one-off check | A manual run doesn't move the schedule or prove an earlier occurrence ran. Use a domain-specific backfill for missing work. |
Check the schedule before retrying the job
Start with the exact cron ID so you don't inspect a different schedule for the same app.
gregale cron list --app my-api
gregale cron get "$CRON_ID"
gregale cron occurrences "$CRON_ID" --limit 10
gregale cron runs "$CRON_ID"
Look at the timestamps in the schedule's timezone. Use occurrence history for the scheduler's decision, run history for the outcome, and the invocation ID to connect an execution to your own logs. Don't expect a skipped time to produce an app log entry. After downtime, Gregale can run the latest missed occurrence instead of replaying the entire backlog. Check the schedule policy and decide whether your application needs to backfill the missing work.
Find the run that blocked an overlap
The example also schedules an 85-second command once a minute with --skip-if-running. Command crons require app Tasks in the workspace. Let the first occurrence start, then look at the decision for the next minute:
gregale cron occurrences "$COMMAND_CRON_ID" --limit 10
A skipped_overlap row explains why the scheduled time did not start another task. Its blocking_occurrence_id points to the earlier occurrence. Inspect that occurrence for the task ID. The script checks that the skipped row has no app-task ID, then disables the temporary command schedule. A failed app execution looks different: it has a run with an outcome and an error, as in the HTTP example below.
Make a job fail, then verify the fix
Download the stateless Python starter. It has no database, credentials, or external dependencies at runtime. Use the Gregale CLI, Bash, jq, curl, and openssl. Export a test-workspace GREGALE_TOKEN that can create, deploy, inspect, and delete a disposable app and its schedules. From the extracted folder:
bash run-demo.sh
The script creates a new private app with a randomized name, deploys the starter, and creates a cron pointed at POST /jobs/fail. The route deliberately returns HTTP 500 only for cron invocations. A manual run with --wait reports the failure; cron runs records what the app returned. The script then points the same cron to /jobs/ok and verifies that a second manual run succeeds. The job isn't made safe by retrying: the same request now goes to a healthy handler.
A manual run is useful for testing a fix, but treat it as a real invocation. A timed-out CLI wait does not tell you the job never ran. Check run history before retrying a job that emails customers, imports data, or charges a card. Give the job a durable business key for the period or batch it processes so that backfills don't repeat work.
Monitor what's missing, not just what's failing
A failure alert catches executions that return errors. A missed-cron alert tells you when scheduled times pass without a success, including times when there is no new execution error. Pair them for jobs where missing output is as serious as a failed run.
See schedule policies and run history, alert configuration, and hosting scheduled jobs.
Questions
- Why did my cron job not run?
Check the expression, timezone, enabled state, and scheduled occurrences. A schedule can deliberately skip a time when a previous invocation is still active.
- How can I tell if a cron was skipped or failed?
On Gregale, cron occurrences shows scheduler decisions for scheduled times; cron runs shows executions that started and their outcomes. A skip does not necessarily create a run.
- Does manually running a cron change its schedule?
No. An explicit Gregale manual run tests the current handler without moving its next scheduled time.