Think Build Implement Repeat
London, UK +44 7367 067226
WhatsApp FOLLOW f in X
  1. Home
  2. Blog
  3. Work That Happens Without Anyone Asking
PHP Development

Work That Happens Without Anyone Asking

Cron jobs and scheduled tasks in PHP fail silently. Alert on completion, make tasks idempotent, prevent overlapping runs and design them to restart safely.

Updated 2 min readBy SpiderHunts Technologies

Free estimateNo obligation

Get a free estimate

Tell us what you need. A senior engineer reads every enquiry.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →

Quick answer — TL;DR

Scheduled work fails silently more than anything else in an application. Alert on completion as well as failure, make tasks idempotent, and prevent overlapping runs.

Silent failure is the norm

A scheduled task that stops running produces no error anywhere. The report is not sent, the sync does not happen, and nobody notices until someone asks why a number looks wrong.

Alert on completion, not just on failure. A job that never started looks identical to a job with nothing to do, and only a completion alert distinguishes them.

What every scheduled task needs

  1. Idempotency — running twice must not double the effect
  2. Overlap protection — a slow run must not be joined by the next one
  3. Logging of start, finish and what was processed
  4. A completion signal that is monitored
  5. A time limit, so a stuck job does not run forever

Use the framework's scheduler

Modern frameworks provide a scheduler defined in code, driven by a single system cron entry. That keeps the schedule in version control and visible to developers.

A dozen separate crontab entries edited on the server is the alternative, and it is invariably out of date and undocumented.

Design for restartability

  • Process in batches with progress recorded
  • A restarted job should resume, not restart from the beginning
  • Failures on one record should not stop the run
  • Failed records quarantined with the reason

A nightly job that fails at ninety per cent and has to start again from nothing will eventually fail to complete at all.

Watch the clock

IssueGuard
Daylight saving changesSchedule in UTC
Jobs overlappingLocking
Jobs running longer over timeDuration monitoring
Several heavy jobs at onceStagger the schedule
Month-end volume spikesTest at realistic volume

FAQ

Frequently asked questions

The questions readers ask us after this guide.

Still have a question?

Ask us directly — a senior engineer will get back to you.

Ask about your project

How do we know a scheduled job ran?

A completion record that is monitored, with an alert if it does not appear within the expected window.

What if a job takes longer than its interval?

Locking prevents overlap. Also investigate why — growing duration usually means growing data with an unindexed query.

Should scheduled work go through the queue?

Frequently a good pattern — the scheduler enqueues work and workers process it. That gives you retries and observability for free.

What about time zones?

Schedule in UTC and convert for display. Scheduling in local time causes duplicate or missed runs twice a year.

Keep reading

More on PHP Development

PHP Development

Why PHP Is Still a Sensible Choice

Is PHP still a good choice for business applications? Where modern, typed PHP fits, where another language is better, and the hosting and hiring arguments.

PHP Development

Improving Old Code Without a Rewrite

Modernising a legacy PHP application without a rewrite: move to a supported PHP version, add tests around what matters, then strangle rather than replace.

Start here

Overnight job that might not have run?

If you cannot tell without checking manually, that is the problem. Completion alerting is a small fix.

  1. You tell us what you needTwo minutes on the form, or a message on WhatsApp.
  2. A senior engineer reviews itAnd comes back with questions, a realistic range and an honest view on fit.
  3. Free 30-minute scoping callWe talk through scope, options and a realistic estimate — with no obligation.
Free estimateNo obligation

Talk to someone who builds this

Send a short brief and we will come back with an honest view and a realistic range.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →