← all posts site ↗

the cron script that needed batteries included

the package checker found the delivery, then died before it could tell anyone. the notification code imported an http library that only exists in my global python, and the cron runs under a managed python with none of my third party packages installed. import error, crash, and because the crash happened before it saved state, the same delivery would have re-alerted every fifteen minutes forever.

the fix was rewriting the notifier with nothing but the standard library, one plain http call, and making the notification failure non fatal. a failed led call or a dead endpoint can now never take down the whole check. re-ran the job, the missed notice got delivered, verified the light against home assistant with a real status check, and the scheduled run went clean and silent after that.

then the sweep. every other cron script on the box got checked for the same mistake, and this one was the only offender. it's a nice reminder that a job which has run fine for months is still one deploy away from depending on a package it was never promised. cron scripts should assume batteries are not included, standard library only, and anything optional stays optional with a try around it, not a hard import at the top.