<?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: Gabrian Mak</title>
    <description>The latest articles on DEV Community by Gabrian Mak (@makgabri).</description>
    <link>https://dev.to/makgabri</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%2F4085301%2Fe08cafda-4fdd-47e1-9c76-af202cba1409.png</url>
      <title>DEV Community: Gabrian Mak</title>
      <link>https://dev.to/makgabri</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/makgabri"/>
    <language>en</language>
    <item>
      <title>Get emailed if a cron job never ran</title>
      <dc:creator>Gabrian Mak</dc:creator>
      <pubDate>Wed, 19 Aug 2026 15:54:55 +0000</pubDate>
      <link>https://dev.to/makgabri/get-emailed-if-a-cron-job-never-ran-boo</link>
      <guid>https://dev.to/makgabri/get-emailed-if-a-cron-job-never-ran-boo</guid>
      <description>&lt;p&gt;A cron that never starts cannot email you. I found that out the hard way with a nightly database backup. I ended up hardcoding a ping that only fired after the dump finished. If the ping never showed up, the backup did not happen. Silent failure. No email from the job itself.&lt;/p&gt;

&lt;p&gt;Same class of bugs: crontab removed in a deploy, the box down at 2am, a lock file that never cleared, a script that exited before it did the real work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The pattern&lt;/strong&gt;&lt;br&gt;
Do not wait for the job to report failure. Expect a heartbeat after success. If the next one never arrives, that is the failure.&lt;/p&gt;

&lt;p&gt;This is not uptime monitoring. You are not polling a public URL. The job tells you it ran.&lt;/p&gt;

&lt;p&gt;Ping only when the script actually succeeded:&lt;br&gt;
&lt;code&gt;# Nightly job at 2:00 AM — ping only if backup.sh succeeded&lt;br&gt;
0 2 * * * /usr/local/bin/backup.sh &amp;amp;&amp;amp; curl -fsS -X POST https://www.gonewatch.com/api/heartbeat/YOUR_TOKEN&lt;/code&gt;&lt;br&gt;
&lt;em&gt;&amp;amp;&amp;amp;&lt;/em&gt; matters. A failed dump should not look healthy.&lt;/p&gt;

&lt;p&gt;One URL per job. Database dump, file sync, and offsite copy are three different things. If you fold them into one ping, you will not know which part died.&lt;/p&gt;

&lt;p&gt;Give yourself a grace window. A dump that runs 20 minutes late is not the same as a dump that never ran. Tune grace to how late the job can be without it being a problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub Actions&lt;/strong&gt;&lt;br&gt;
GitHub emails a failed run. It does not email a scheduled workflow that never started. Last step, success only:&lt;br&gt;
&lt;code&gt;- name: Heartbeat&lt;br&gt;
  if: success()&lt;br&gt;
  run: curl -fsS -X POST "$HEARTBEAT_URL"&lt;br&gt;
  env:&lt;br&gt;
    HEARTBEAT_URL: ${{ secrets.HEARTBEAT_URL }}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I wrapped it in&lt;/strong&gt;&lt;br&gt;
I got tired of maintaining that ping by hand, so I put it in &lt;a href="https://www.gonewatch.com" rel="noopener noreferrer"&gt;Gonewatch&lt;/a&gt;. Same idea: create a monitor, paste the curl (or a tiny GitHub Action), get emailed if the ping stops. Free to start, no credit card.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>webdev</category>
      <category>cron</category>
    </item>
  </channel>
</rss>
