Quantcast
Channel: Question and Answer » cron
Viewing all articles
Browse latest Browse all 165

How can a site programmatically detect if cron has not run in a long time?

$
0
0

I’m developing a module intended to proactively warn the admin if there are problems with the site. The idea is to periodically check the system status report and sends an email notice if certain statuses have gone from REQUIREMENT_OK to REQUIREMENT_WARNING or REQUIREMENT_ERROR. I’m planning on firing this check in hook_cron().

But what if the problem with the site is that cron is broken? What is a safe and performant way for the site to periodically check if the ‘cron_last’ variable is too old, that doesn’t rely on cron?

I would like to keep the module self-contained and avoid external dependencies or “phone home” solutions.


Viewing all articles
Browse latest Browse all 165