Linux 软件免费装
Banner图

Cronheart

开发者 cronheart
更新时间 2026年11月13日 21:58
PHP版本: 8.2 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

cron monitoring wp-cron healthcheck deadman-switch

下载

0.5.4 0.6.0 0.3.0 0.5.7 0.4.0 0.5.5 0.5.6 0.1.9 0.2.1 0.5.0 0.5.1 0.5.2 0.5.3

详情介绍:

WP-Cron stopped and nothing told you. WordPress runs its scheduled jobs only when someone visits the site. On a quiet site, a backup, a newsletter or a cleanup can stay stalled for weeks before anyone notices. Uptime monitors do not catch it: the site answers over HTTPS just fine, it simply is not running its jobs. Cronheart turns WP-Cron into a dead-man switch. The plugin pings cronheart.com every five minutes, and sends a start, success or fail ping around every run of each event you register. If the pings stop, or a job fails, cronheart alerts you by email, Telegram, Slack, Discord, Microsoft Teams, Google Chat, PagerDuty or a signed webhook. Setup in 4 steps
  1. Install and activate the plugin.
  2. Create a free account at cronheart.com.
  3. Add a monitor for your site that expects a ping every 5 minutes, and copy its UUID.
  4. Paste the UUID under Settings → Cronheart and save. The first heartbeat is sent on the next WP-Cron run.
Step by step: Monitor WordPress cron with Cronheart. What it does Requirements Never breaks WP-Cron The plugin's hard contract: a broken cronheart backend, an unreachable network, a misbehaving PSR-18 HTTP client — none of them may cause WP-Cron to fail. Every network / HTTP error is swallowed; with WP_DEBUG and WP_DEBUG_LOG on, a ping that fails leaves one line in the debug log. A third-party filter that throws while the plugin reads its settings is caught too. If cronheart goes down for a day, your wp_schedule_event callbacks still run normally; you just stop seeing pings on the dashboard. When the plugin cannot send pings safely (the PHP cURL extension is missing, or the endpoint setting is one it does not accept), it sends none and shows an error notice in wp-admin instead. External services This plugin sends HTTP requests to cronheart.com in two distinct situations: the monitoring pings your scheduled jobs send, and the account-management calls the admin settings page makes. Both are opt-in: without configuration the plugin loads and does nothing — no telemetry, no usage statistics, no anonymous reports. 1. Monitoring pings (front end / WP-Cron). Sent on every scheduled WP-Cron run, but only when you supply a monitor UUID. The exact data sent per ping: 2. Account management (wp-admin only). When — and only when — you save a cronheart.com API token, the Cronheart admin screens (Settings → Cronheart, Settings → Cronheart Events, Settings → Cronheart Channels, and Settings → Cronheart History) talk to the cronheart.com management API at https://cronheart.com/api/v1/.... Every such request carries the token as an Authorization: Bearer header and runs only while a logged-in administrator is on one of those screens — and, for the write actions below, only when that administrator clicks the control. Never on the front end, during WP-Cron, or in any other context. No token, no request. The calls are: The lifecycle, create, test, and rotate-secret calls are the only requests that change anything — and "Send test" additionally delivers a real notification to the channel's destination, while "Rotate secret" invalidates the old webhook secret — but each is one deliberate administrator click. The token is optional: without it the plugin makes none of these management calls — you assign monitors by hand (or via the constants / helper) and only the monitoring pings above are ever sent. Cronheart.com Terms of Service · Privacy policy Open source Source code and issue tracker: github.com/alexander-po/cronheart-wp. The plugin wraps the cron-monitor/php-sdk PHP package (also open source, MIT-licensed). Both projects are maintained independently.

安装:

The plugin needs PHP 8.2 or later with the cURL extension (curl), which most hosts enable. Without the extension the plugin sends no pings and shows an error notice in wp-admin.
  1. Install the plugin: WP Admin → Plugins → Add New → search for "Cronheart" → Install Now → Activate. Or upload cronheart.zip from a GitHub release.
  2. Sign up at cronheart.com and create a monitor for your site's heartbeat, with a 5-minute schedule. Copy the monitor UUID from the dashboard. Until a UUID is set, a notice on the Plugins screen and the Dashboard links to the setup; you can dismiss it.
  3. Configure the UUID. Either add it to wp-config.php with define( 'CRONHEART_HEARTBEAT_UUID', 'xxxxxxxx-…' ); (recommended), or paste it under Settings → Cronheart in the WP admin.
  4. Done. If you saved the UUID under Settings, saving queues one heartbeat for the next WP-Cron run, so the first heartbeat ping shows on the cronheart dashboard shortly after. With the wp-config.php constant, the first ping arrives within five minutes. From then on it repeats every five minutes.
  5. (Optional) To choose a monitor from a dropdown instead of pasting its UUID, create a Personal Access Token at cronheart.com (Account → API tokens) and save it under Settings → Cronheart. Every plan, the free one included, can use the API; the account email must be verified before a token can be created. The plugin works fully without a token. For production, prefer define( 'CRONHEART_API_TOKEN', 'cmk_…' ); in wp-config.php to keep the account credential out of the database.
For per-event monitoring (a specific scheduled hook, not just the site heartbeat), register the hook from a plugin / theme / mu-plugin: add_action( 'plugins_loaded', function () { cronheart_monitor( 'my_nightly_report', 'xxxxxxxx-…' ); }, 1 ); The hook then emits start / success (or fail on a fatal / thrown exception) pings on every scheduled run.

屏幕截图:

  • Settings, Cronheart: the three first-run steps and the field for the monitor UUID.
  • The Cronheart Events screen: the site's recurring WP-Cron events, each with a dropdown to assign a monitor or an Auto-create and assign button once an API token is saved.
  • The Cronheart Channels screen: your notification channels, each with a Send test action and, for webhook channels, a Rotate secret action.

升级注意事项:

0.6.0 Adds a dismissible setup notice and a Settings link, and queues a first heartbeat when you save a monitor UUID. No settings change; the ping path is unchanged. 0.5.7 A throwing third-party cron filter no longer stops plugin activation or deactivation. 0.5.6 An endpoint setting the plugin does not accept now stops pings, with an error notice in wp-admin, instead of sending them to cronheart.com. Also: no fatal error without the cURL extension, and failed pings in the debug log. 0.5.5 A failing monitored event run with wp cron event run now reports fail instead of leaving the monitor up. No settings change. 0.5.4 Pings are tried up to three times with a 3 second timeout per attempt, and the bundled SDK is updated to 1.9. No settings change. 0.5.3 Maintenance release: code comments and development tooling only. No change in behaviour. 0.5.2 Corrects the page name in the invalid API token notice: tokens are created under Account → API tokens on cronheart.com. Wording only. 0.5.1 Bundles cron-monitor/php-sdk 1.5.2: a monitor UUID with a trailing newline is refused before any request, and the API token and monitor UUIDs stay out of the SDK's stack-frame arguments. Also corrects copy that tied the REST API to a paid plan. 0.5.0 Adds Cronheart Channels (test a channel, rotate a webhook secret) and Cronheart History (recent pings & alerts) screens. "Send test" sends a real notification; a rotated secret is shown once. The API token now needs an https:// endpoint; the ping path is unchanged. 0.4.0 Adds a Cronheart Events screen to assign or auto-create monitors for your recurring WP-Cron events from wp-admin — no code needed. Same admin-AJAX safety as 0.3.0; the constants and helper still work and take precedence. No token required; the runtime ping path is unchanged. Safe to upgrade. 0.3.0 Adds an account/plan card and a "Your monitors" table to pause, resume, snooze, or unsnooze monitors from wp-admin — the plugin's first admin-AJAX endpoint, nonce- and capability-gated. No token required; the runtime ping path is unchanged. Safe to upgrade. 0.2.1 Documentation + screenshot refresh for the 0.2.0 monitor picker. No code change. Safe to upgrade. 0.2.0 Adds an optional monitor picker: save a cronheart.com API token and choose your heartbeat monitor from a dropdown instead of pasting a UUID. No token required — manual UUID entry works exactly as before. The runtime ping path is unchanged. Safe to upgrade. 0.1.9 Plugin Directory review round 2 metadata fix (Contributors set to the slug owner). No code changes. Safe to upgrade. 0.1.8 "Tested up to" bump to 7.0. No code changes. Safe to upgrade. 0.1.7 Restored Terms / Privacy links with the correct URLs (cronheart.com/terms and /privacy). No code changes. 0.1.6 Plugin Directory review round 1 metadata fixes. No code changes. Safe to upgrade. 0.1.5 "Tested up to" bump to 6.9. No code changes. Safe to upgrade. 0.1.4 Pre-submission cleanup only — no behaviour changes. Safe to upgrade. 0.1.3 WordPress.org Plugin Check fixes only — no behaviour changes. Safe to upgrade. 0.1.2 WordPress.org metadata polish only. Safe to upgrade. 0.1.1 Adds opt-in endpoint override. Existing installs are unaffected — the default endpoint remains https://cronheart.com.

常见问题:

Why not just use an uptime monitor?

An uptime monitor checks that your site answers requests. It does not know whether WordPress ran its scheduled jobs: a site can serve every page while its backups, emails and cleanups are stalled. Cronheart watches the jobs themselves, and alerts you when the heartbeat stops or a monitored job fails.

How long until I see the first ping?

Saving a monitor UUID under Settings queues one heartbeat for the next WP-Cron run, which on a site with visitors is the next page load. If you defined the UUID in wp-config.php instead, the first ping arrives within five minutes. After that the plugin pings every five minutes. On a site that has WP-Cron disabled, it happens on the next run of your system cron.

How do I monitor my own scheduled jobs, not just the site?

Two ways. With an API token saved under Settings → Cronheart, the Cronheart Events screen lists your recurring events and lets you assign a monitor to each, or create one in one click. Without a token, register a hook in code with cronheart_monitor( 'my_nightly_report', 'xxxxxxxx-…' );. A CRONHEART_EVENT_<HOOK>_UUID constant in wp-config.php then supplies or overrides that hook's UUID.

Is it free?

Yes. The Free plan on cronheart.com covers 20 monitors, needs no credit card and does not expire. Every plan, the free one included, has all notification channels and the REST API. Paid plans raise the monitor count and the API rate limit; see cronheart.com/pricing.

Does this work when WP-Cron is disabled (system-cron mode)?

Yes. If you set define( 'DISABLE_WP_CRON', true ); and trigger wp-cron.php from a real system cron, the plugin's cronheart_heartbeat_tick event still fires on each run — the trigger mechanism is different, the action chain is the same. Running events with WP-CLI (wp cron event run --due-now) works as well, including the fail ping of an event that throws.

What if my host blocks outgoing HTTPS?

The plugin will retry up to twice (three attempts in all, each limited to 3 seconds) after a connection error or a server error, then give up; an answer that refuses the ping, such as a wrong monitor UUID, is not retried. Your scheduled callbacks still run normally — the plugin never raises an exception that could break the cron runner. The monitor on cronheart.com reports the missed run. With WP_DEBUG and WP_DEBUG_LOG on, each ping that fails also leaves one line in wp-content/debug.log (a ping the service refuses, such as one with a wrong monitor UUID, too), with the reason but without the monitor UUID or the full ping URL.

Do I need an API token?

No — it is entirely optional. Paste a monitor UUID under Settings → Cronheart (or define it in wp-config.php) and the plugin works on any plan, including the free tier. A token only adds convenience: the settings page can then list your monitors and let you pick one from a dropdown instead of copying a UUID by hand. The token is an account-level credential, so for production prefer defining CRONHEART_API_TOKEN in wp-config.php over storing it in the database. The token features work on every plan, the free one included, but cronheart.com only lets an account with a verified email address create a token. If the token is refused or cronheart.com cannot be reached, the page shows a notice and falls back to manual UUID entry.

Where do I find my monitor UUID?

Sign in at cronheart.com, open the monitor you created, and copy the UUID shown under its name (it has a copy button), or take it from the address bar or from the end of the monitor's ping URL.

What happens to my scheduled jobs if cronheart.com is unreachable?

Nothing. The plugin catches every network / HTTP error from the SDK (and, with WP_DEBUG and WP_DEBUG_LOG on, writes one line per failed ping to the debug log) — your wp_schedule_event callbacks continue to run. You will stop seeing pings on the cronheart dashboard, and after the configured grace period cronheart sends you the down-alert. When cronheart comes back the next successful ping resolves the incident automatically.

Does the plugin track or report anything about my site?

No. The plugin sends a ping to cronheart only when you have configured a monitor UUID. The ping payload is the UUID, an optional short body excerpt (capped at 10 KB), and the SDK's User-Agent header. There is no anonymous-statistics beacon, no plugin-usage telemetry, no calls to any third-party analytics service.

Can I point the plugin at a non-production cronheart deployment (staging / private / self-hosted)?

Yes. Define CRONHEART_ENDPOINT in wp-config.php with the URL of your alternate deployment. For plain http:// endpoints (local development, private VPNs without TLS) also set CRONHEART_ALLOW_INSECURE_ENDPOINT to true. With both unset, the plugin pings the production cronheart.com over HTTPS. The API token is only ever sent over HTTPS, so with a plain http:// endpoint the settings screens fall back to manual UUID entry while pings keep working. An endpoint the plugin does not accept (one with no http:// or https:// scheme, or plain http:// without CRONHEART_ALLOW_INSECURE_ENDPOINT) stops all pings and shows an error notice in wp-admin; the plugin does not send them to cronheart.com instead. An empty CRONHEART_ENDPOINT means cronheart.com even when the cronheart_endpoint option is set, and a CRONHEART_ENDPOINT that is not a string is ignored.

What does the "Cronheart is not sending pings" notice mean?

The plugin shows this error notice on every wp-admin screen, to users who can manage options, when it cannot send pings safely; it then sends none. The notice names the cause. If the PHP cURL extension is not loaded on the server, ask your host to enable it. If the endpoint setting is not accepted, the notice says whether CRONHEART_ENDPOINT in wp-config.php or the cronheart_endpoint option holds it: use an https:// URL (a plain http:// URL also needs CRONHEART_ALLOW_INSECURE_ENDPOINT), or remove the setting to use cronheart.com. Until then your monitors alert that the jobs stopped checking in. The notice cannot be dismissed; it disappears on the next page load after the cause is fixed.

Where can I report bugs or request features?

Open an issue on GitHub.

更新日志:

0.6.0 0.5.7 0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 0.4.0 0.3.0 0.2.1 0.2.0 0.1.9 0.1.8 0.1.7 0.1.6 0.1.5 0.1.4 0.1.3 0.1.2 0.1.1 0.1.0