<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mihail</title>
    <description>The latest articles on DEV Community by Mihail (@mihailz).</description>
    <link>https://dev.to/mihailz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4074132%2F4692082f-443c-4911-bc0a-bd7912c7d357.jpg</url>
      <title>DEV Community: Mihail</title>
      <link>https://dev.to/mihailz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mihailz"/>
    <language>en</language>
    <item>
      <title>The mistake I made first: setting grace periods as a fraction of the interval instead of p95 runtime plus jitter. Got paged at 3 AM for jobs that were 40 seconds late, then started ignoring the alerts — which defeats the whole point.</title>
      <dc:creator>Mihail</dc:creator>
      <pubDate>Mon, 17 Aug 2026 15:43:15 +0000</pubDate>
      <link>https://dev.to/mihailz/the-mistake-i-made-first-setting-grace-periods-as-a-fraction-of-the-interval-instead-of-p95-1fb0</link>
      <guid>https://dev.to/mihailz/the-mistake-i-made-first-setting-grace-periods-as-a-fraction-of-the-interval-instead-of-p95-1fb0</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/mihailz/your-laravel-scheduler-failed-at-3-am-when-would-you-find-out-4nph" class="crayons-story__hidden-navigation-link"&gt;Your Laravel scheduler failed at 3 AM. When would you find out?&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/mihailz" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4074132%2F4692082f-443c-4911-bc0a-bd7912c7d357.jpg" alt="mihailz profile" class="crayons-avatar__image" width="96" height="96"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/mihailz" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Mihail
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Mihail
                
                
              
              &lt;div id="story-author-preview-content-4418278" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/mihailz" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4074132%2F4692082f-443c-4911-bc0a-bd7912c7d357.jpg" class="crayons-avatar__image" alt="" width="96" height="96"&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Mihail&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/mihailz/your-laravel-scheduler-failed-at-3-am-when-would-you-find-out-4nph" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Aug 17&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/mihailz/your-laravel-scheduler-failed-at-3-am-when-would-you-find-out-4nph" id="article-link-4418278"&gt;
          Your Laravel scheduler failed at 3 AM. When would you find out?
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/laravel"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;laravel&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/php"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;php&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/devops"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;devops&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/webdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;webdev&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
            &lt;a href="https://dev.to/mihailz/your-laravel-scheduler-failed-at-3-am-when-would-you-find-out-4nph#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              

              &lt;span class="hidden s:inline"&gt;Add&amp;nbsp;Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            5 min read
          &lt;/small&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>devops</category>
      <category>laravel</category>
      <category>monitoring</category>
      <category>php</category>
    </item>
    <item>
      <title>Your Laravel scheduler failed at 3 AM. When would you find out?</title>
      <dc:creator>Mihail</dc:creator>
      <pubDate>Mon, 17 Aug 2026 12:54:52 +0000</pubDate>
      <link>https://dev.to/mihailz/your-laravel-scheduler-failed-at-3-am-when-would-you-find-out-4nph</link>
      <guid>https://dev.to/mihailz/your-laravel-scheduler-failed-at-3-am-when-would-you-find-out-4nph</guid>
      <description>&lt;p&gt;Every Laravel app accumulates scheduled jobs: backups, report emails, cache&lt;br&gt;
warmups, cleanup tasks, data syncs. And every one of them fails the same way —&lt;br&gt;
&lt;strong&gt;silently&lt;/strong&gt;. &lt;code&gt;schedule:run&lt;/code&gt; exits 0 whether your backup ran or not. If the&lt;br&gt;
server's cron entry disappears, if the job throws, if it hangs on a lock —&lt;br&gt;
nothing happens. No error page, no failed request, no log entry you'd ever&lt;br&gt;
look at. The absence of a thing is invisible.&lt;/p&gt;

&lt;p&gt;The classic story: a backup job dies in March, and you learn about it in&lt;br&gt;
September, on the day you actually need the backup.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Laravel gives you out of the box
&lt;/h2&gt;

&lt;p&gt;Laravel is honest about this problem — the scheduler has hooks for it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$schedule&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'backup:run'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;daily&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;onFailure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="cm"&gt;/* notify someone */&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;thenPing&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'https://example.com/ping/backup'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two limitations, though.&lt;/p&gt;

&lt;p&gt;First, &lt;code&gt;onFailure&lt;/code&gt; only fires &lt;strong&gt;when the task runs and fails&lt;/strong&gt;. It cannot&lt;br&gt;
tell you about the task that never started: crontab wiped by a server&lt;br&gt;
migration, a supervisor that stopped restarting, a deploy that dropped&lt;br&gt;
&lt;code&gt;routes/console.php&lt;/code&gt; changes. The most dangerous failure mode is the one&lt;br&gt;
where your code never executes — and in-process hooks can't see it by&lt;br&gt;
definition.&lt;/p&gt;

&lt;p&gt;Second, &lt;code&gt;thenPing&lt;/code&gt; solves that (it's a &lt;em&gt;dead man's switch&lt;/em&gt;: an external&lt;br&gt;
service alerts you when pings &lt;strong&gt;stop arriving&lt;/strong&gt;), but it's manual. You&lt;br&gt;
create a check in some dashboard, copy its URL, paste it into the code, and&lt;br&gt;
repeat for every task. Twenty tasks, twenty copy-pastes. Then someone changes&lt;br&gt;
&lt;code&gt;daily()&lt;/code&gt; to &lt;code&gt;twiceDaily()&lt;/code&gt; in code and forgets to update the expected&lt;br&gt;
schedule in the dashboard — now you get false alerts, or worse, none.&lt;/p&gt;
&lt;h2&gt;
  
  
  One line per task, schedule included
&lt;/h2&gt;

&lt;p&gt;This is the problem &lt;a href="https://cronalive.com" rel="noopener noreferrer"&gt;CronAlive&lt;/a&gt; was built around.&lt;br&gt;
Install the SDK:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require cronalive/laravel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two env vars:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="py"&gt;CRONALIVE_PING_DOMAIN&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;https://ping.cronalive.com&lt;/span&gt;
&lt;span class="py"&gt;CRONALIVE_PING_KEY&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;your project ping key&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then, per task, one method call — no dashboard round-trip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$schedule&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'backup:run'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;dailyAt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'03:30'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;pingCronaliveSlug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'backup'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;graceSec&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tags&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'backups'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'prod'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the first ping the check &lt;strong&gt;creates itself&lt;/strong&gt;, and — this is the part that&lt;br&gt;
matters — it reads the schedule off your scheduled task. &lt;code&gt;-&amp;gt;dailyAt('03:30')&lt;/code&gt;&lt;br&gt;
becomes &lt;code&gt;cron=30 3 * * *&lt;/code&gt;, the task's timezone travels with it, &lt;code&gt;graceSec&lt;/code&gt;&lt;br&gt;
sets how late a ping may be before alerting, tags group checks on the&lt;br&gt;
dashboard. The schedule lives in your code and only in your code; the&lt;br&gt;
monitoring can't drift out of sync with it, because it was never retyped&lt;br&gt;
anywhere.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Your task&lt;/th&gt;
&lt;th&gt;What the check learns&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-&amp;gt;everyFiveMinutes()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;cron=*/5 * * * *&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-&amp;gt;dailyAt('03:30')-&amp;gt;timezone('Europe/Berlin')&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;cron=30 3 * * *&lt;/code&gt;, &lt;code&gt;tz=Europe/Berlin&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-&amp;gt;everyThirtySeconds()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;period=60&lt;/code&gt; (see gotchas)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The macros also signal the run itself: &lt;code&gt;/start&lt;/code&gt; before the job, and after&lt;br&gt;
it either a success ping (the plain check URL — success is the default&lt;br&gt;
case, so it has no suffix) or &lt;code&gt;/fail&lt;/code&gt;. That gets you three things for&lt;br&gt;
free: alerts on jobs that&lt;br&gt;
&lt;strong&gt;started but never finished&lt;/strong&gt; (hung on a lock, killed by OOM), alerts on&lt;br&gt;
jobs that exited non-zero, and a run-duration chart per job — so you notice&lt;br&gt;
the backup that quietly went from 4 minutes to 40 before it becomes the&lt;br&gt;
backup that overlaps its next run.&lt;/p&gt;

&lt;p&gt;Pings are fire-and-forget and never throw. If the monitoring service is&lt;br&gt;
unreachable, your backup still runs — monitoring must not break the thing&lt;br&gt;
it monitors.&lt;/p&gt;

&lt;h2&gt;
  
  
  A real production example
&lt;/h2&gt;

&lt;p&gt;Our own dogfood project runs 47 scheduled tasks through this — invoicing,&lt;br&gt;
exports, queue maintenance, certificate renewals. The whole migration was&lt;br&gt;
one method call per task in &lt;code&gt;Kernel.php&lt;/code&gt;, and the checks appeared on the&lt;br&gt;
dashboard by themselves on the next scheduler tick, each with its own cron&lt;br&gt;
expression, timezone and grace already filled in.&lt;/p&gt;

&lt;p&gt;Since then it has caught exactly the failures the in-process hooks can't:&lt;br&gt;
a task that stopped being scheduled at all after a refactor, and a nightly&lt;br&gt;
job that hung on a stale cache lock — visible as a &lt;code&gt;/start&lt;/code&gt; with no finish,&lt;br&gt;
alert in Telegram before breakfast.&lt;/p&gt;

&lt;p&gt;One of those tasks is the certificate renewal, and it marks the limit of&lt;br&gt;
what heartbeats can tell you. A green check proves the renewal &lt;strong&gt;ran&lt;/strong&gt; —&lt;br&gt;
not that the new certificate ever reached the edge. A reload that quietly&lt;br&gt;
failed leaves you with a happy scheduler and a site that stops loading for&lt;br&gt;
everyone in three weeks. Same shape as the original problem, one level up:&lt;br&gt;
the job succeeded, the outcome is false.&lt;/p&gt;

&lt;p&gt;That question is answered from the outside — an &lt;a href="https://cronalive.com/docs/http-checks/" rel="noopener noreferrer"&gt;HTTP check&lt;/a&gt;&lt;br&gt;
against the public URL, run from several regions, watching the status code,&lt;br&gt;
the response time and the expiry date of the certificate that is actually&lt;br&gt;
on the wire. It is the natural other half of job monitoring: heartbeats&lt;br&gt;
watch the work, HTTP checks watch the result. Both live on the same&lt;br&gt;
dashboard here, which is mostly a comfort at 3 AM — one place to look, one&lt;br&gt;
set of alert channels to keep configured.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gotchas worth knowing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Creating is not updating.&lt;/strong&gt; Schedule parameters apply only when the check&lt;br&gt;
is first created. After that, pings just count — a deploy can never&lt;br&gt;
silently rewrite a schedule someone tuned in the dashboard. Changed the&lt;br&gt;
schedule in code? Update the check in the dashboard, or delete it and let&lt;br&gt;
the next ping recreate it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;-&amp;gt;when()&lt;/code&gt; / &lt;code&gt;-&amp;gt;skip()&lt;/code&gt; filters stop the pings too&lt;/strong&gt;, so a skipped run&lt;br&gt;
looks exactly like a missed one. Pause the check for expected skip windows,&lt;br&gt;
or move the condition inside the job.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sub-minute tasks&lt;/strong&gt; (&lt;code&gt;everyThirtySeconds()&lt;/code&gt; and friends) are monitored as&lt;br&gt;
"pings at least once a minute" — Laravel keeps the real interval outside&lt;br&gt;
the cron expression, and CronAlive's shortest period is 60 seconds. True&lt;br&gt;
for such a job, and it never false-alarms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Grace has a floor of 30 seconds.&lt;/strong&gt; Schedulers start jobs with a few&lt;br&gt;
seconds of jitter; a tighter grace would turn that jitter into false&lt;br&gt;
alerts, so anything lower is raised to 30 rather than refused.&lt;/p&gt;

&lt;h2&gt;
  
  
  Alternatives
&lt;/h2&gt;

&lt;p&gt;Fairness section. &lt;a href="https://healthchecks.io" rel="noopener noreferrer"&gt;Healthchecks.io&lt;/a&gt; is the&lt;br&gt;
best-known dead man's switch — clean, open source, self-hostable; you'll&lt;br&gt;
be managing check URLs by hand or writing your own provisioning against&lt;br&gt;
its API, and uptime monitoring for HTTP endpoints is out of scope. Cronitor&lt;br&gt;
and Dead Man's Snitch are solid too, with the same manual-wiring caveat&lt;br&gt;
for Laravel. If you only have two or three tasks and don't mind the&lt;br&gt;
copy-paste, &lt;code&gt;thenPing&lt;/code&gt; plus any of them is a perfectly good setup.&lt;/p&gt;

&lt;p&gt;CronAlive's angle is the Laravel-native auto-provisioning above, plus the&lt;br&gt;
HTTP and certificate side in the same dashboard, and alerts via Telegram,&lt;br&gt;
Slack, Discord, email or webhooks. The free plan covers ten checks with no&lt;br&gt;
card — enough to wire up the jobs you actually worry about and see which of&lt;br&gt;
them have been failing.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://cronalive.com/blog/monitoring-laravel-scheduled-jobs/" rel="noopener noreferrer"&gt;CronAlive blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If your scheduler has ever been dead for months without anyone noticing — how did you finally find out? Comments are open, and the war stories are the useful part.&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>devops</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
