cron job not running on macOS exposed missed sleep slots and unfinished jobs
Key points
- WordPress automation scheduled for 36 posts per day across eight sites delivered none from September 15 through September 22. (Source: our own measurement, 2026-09-23)
- On September 23, the Mac slept from 04:58 until 22:32, covering the WordPress scheduling slots examined in the investigation. (Source: our own measurement, 2026-09-23)
- Separate blog scheduling slots fell while the Mac was awake, so sleep could not explain the entire outage. (Source: our own measurement, 2026-09-23)
- Two cron child processes had remained alive for eight days. Their exact blocking condition and the cause of the separate blog outage remained unconfirmed. (Source: our own measurement, 2026-09-23)
The missing posts came with missing execution logs
The WordPress automation was configured to publish 36 posts per day across eight sites. From September 15 through September 22, it delivered none. On September 23, after recovery work, no posts appeared during the daytime either.
The immediate symptom was an absence of execution evidence. The expected ✅ Success and ❌ Error entries were both missing. There was no recorded result to explain why a scheduled post had failed. Looking only at those logs left the investigation with an important distinction unresolved: had the job failed, or had it never run?
This was the third complete interruption recorded for the automation. The earlier incidents had different established causes. In one, cron’s PATH lacked node, and claude could not be found. In another, cron lacked an SSH agent, and WordPress posting failed with a publickey error.
Those earlier repairs addressed specific execution problems. The new incident required checking whether execution had happened at all. A schedule containing the intended posting times did not establish that the work had reached article generation or WordPress.
The earlier September interval also contained actual execution failures. The record says the network was down, and the few runs that did start failed during article generation with this error:
API Error: Can't reach the API server (ENOTFOUND)
No WordPress posts resulted from those attempts. The outage therefore contained both missing executions and executions that failed before publishing. Treating every absent post as the same event would have hidden that difference.
Source: our own measurement, 2026-09-23.
Sleep explained the WordPress slots, but not every outage
The power history provided a concrete explanation for the WordPress behavior on September 23. The investigation used:
pmset -g log
The recorded sleep interval began at 04:58 and ended at 22:32. All the WordPress firing times examined for that day fell within that interval.
A missed sleep slot is a scheduled cron execution whose firing time occurs while the Mac is asleep.
The incident record describes cron as skipping that slot without recovering it after wake. Under that behavior, the configured daily posting schedule depended on the Mac being awake when each slot arrived. The missing success and error entries were consistent with work that had never started.
That finding was specific enough to explain the examined WordPress slots. It was not sufficient to explain a separate blog publishing job scheduled for 07:20.
The available power history began at 23:30 on September 16. It therefore could not establish whether the Mac was asleep during the morning slots on September 15 or September 16. Missing historical power records were not evidence of sleep.
For September 17 through September 22, the immediately preceding power event for each 07:20 blog slot was Wake. The investigation recorded the Mac as awake for all six slots, yet the blog runs were absent.
This changed the scope of the conclusion. Sleep explained the WordPress scheduling failure observed on September 23. It did not explain the blog job’s missing runs while the machine was awake, and the retained history could not answer the question for the earlier mornings.
Source: our own measurement, 2026-09-23.
Process inspection found unfinished work, not a complete explanation
Inspecting cron’s children revealed another failure mode. Two processes launched on September 15 were still alive eight days later. Both led through shell scripts to Python processes performing YouTube publishing work. The Python processes had not exited.
Those publishing scripts had seven scheduled slots between them. The record identified the risk of accumulating cron children if subsequent executions also hung. However, finding long-lived children did not establish why the separate blog job had stopped.
The chronology prevented that conclusion. The blog job’s last recorded run was September 14 at 07:20. The observed hanging processes began on September 15, after the blog job had already stopped producing its expected record. Their existence could not explain the earlier stop.
The exact condition holding the Python processes open also remained unconfirmed. The record did not establish that they were blocked on standard input. An article about this incident cannot turn an investigated possibility into a diagnosed cause.
The useful finding was narrower: some scheduled work had started and then failed to finish. Moving that work to another scheduler would not, by itself, make the running process terminate.
The record consequently separated the scheduling repair from the execution repair. StartCalendarInterval addressed the sleep-related scheduling behavior described in the investigation — Apple's own guide to creating scheduled jobs documents StartCalendarInterval as the launchd key for calendar-based scheduling, distinct from cron's plain crontab timing. It did not resolve unfinished work after launch.
This distinction also affected observability. The proposed logging change required both an ending entry and an exit code, rather than treating a start entry as evidence of successful operation. Success had to appear in the actual execution record.
Source: our own measurement, 2026-09-23.
The launchd migration briefly left both schedulers active
The chosen scheduling change was to convert the WordPress cron entries into launchd property lists. The conversion script read the existing crontab lines and generated one plist per site, using an array of StartCalendarInterval entries where a site had multiple slots.
Generation was separate from loading. That allowed inspection before activation. The record reports that all ten generated plists passed plutil -lint and that all 36 scheduling slots were converted.
Only one site was migrated initially. The other nine plists remained generated but unloaded.
The intended order was explicit: place the plist, remove that site’s cron entries, and then load the launchd job. That order was meant to avoid leaving the same site active in both schedulers.
During the migration, however, installing the replacement crontab failed. The record gives this command form:
crontab /very/long/path/to/file
It returned:
No such file or directory
The path had been truncated. At that point, the plist was already loaded, briefly leaving the site present in both cron and launchd. The record documents overlapping scheduler configuration, not a confirmed duplicate publication.
Recovery began by unloading the launchd job. The replacement crontab file was then placed at a shorter path and installed with:
crontab /tmp/ct.after
The launchd job was loaded again afterward.
Verification focused on the intended change, not merely whether crontab still existed. The failed installation had left the original crontab intact. The successful replacement therefore needed to show that the target site’s entries were gone and unrelated entries remained.
The recorded line count changed from 174 to 171, matching the removal of three lines. The migrated site had no remaining cron matches and one launchd match. The remaining WordPress cron entries totaled 33.
Source: our own measurement, 2026-09-23.
Check sleep, completion, and migration results separately
The migration was still in progress when the record ended. The investigation described launchd’s wake-time recovery behavior, but had not yet observed that behavior locally under the planned comparison.
Matching probes were installed in cron and launchd, scheduled for minute 07 of every hour. Each wrote to a separate output file. The intended check was to let the Mac sleep and wake naturally, then inspect whether only the launchd probe recorded recovery of missed work. The remaining site migrations were deferred until that observation.
The unfinished processes required separate controls. The record called for a runtime limit, exclusion of overlapping executions, and logs containing completion and exit status. It also distinguished launchd’s ExitTimeOut from a runtime limit: the former was described as a grace period after SIGTERM, not a ceiling on how long a job could run.
For a comparable investigation, begin with the scheduled slot and the evidence available for that specific time. Check the power history’s retention boundary before using it to explain a missing run. Where the machine was awake, preserve that finding instead of extending the sleep explanation.
Then check whether work remained alive after launch. A running child process and an absent scheduled execution are different observations. Neither establishes the other’s cause.
Finally, verify the migration’s actual state: the intended cron lines removed, unrelated lines preserved, and the replacement job loaded. In this case, that check mattered because a failed crontab installation temporarily left both scheduling paths present.
The remaining uncertainty belongs in the result. The local wake-recovery test was pending, the Python blocking condition was unconfirmed, and the separate blog outage still lacked an established cause. The investigation supported a targeted scheduling repair and additional execution controls, not a claim that the entire outage had been solved.
Source: our own measurement, 2026-09-23.
Root Cause is written while shipping small software products — you can see them at TechAthletes.