Menu

How to add dead man's switch monitoring to any cron job in 2 minutes
πŸ–ΌοΈ

How to add dead man's switch monitoring to any cron job in 2 minutes

DEV CommunityΒ·KrissΒ·6 months ago
#ElPaTxj1
#devops#monitoring#tutorial#opensource#ping
Reading 0:00
15s threshold

How to add dead man's switch monitoring to any cron job in 2 minutes

The concept is simple: your job checks in when it runs. If it stops checking in, you get alerted.

No agent to install. No SDK to integrate. Just a curl at the end of your script.

The one-liner

curl -fsS https://deadmancheck.io/ping/YOUR-TOKEN > /dev/null

Enter fullscreen mode

Exit fullscreen mode

That's it. Stick that at the end of your cron job. If the job stops running β€” server dies, cron daemon crashes, script errors out before it gets there β€” you get an alert.

The flags: -f fails silently on HTTP errors, -s suppresses progress output, -S still shows errors if -s is set. Redirect to /dev/null because you don't want curl output polluting your logs.

Setting it up

Sign up at deadmancheck.io (free for up to 5 monitors). Create a monitor, set the expected interval β€” say, every 24 hours β€” and copy your unique token.

Then configure the alert window. If you're running a daily job, set it to alert after 25 hours of silence.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.