Unsophisticated Alerts on Container Update Failures

By chimo on (updated on )

A couple of days ago, I mentioned:

[...]one thing I want to add now is error reporting for those unattended, scheduled upgrades. For this particular case, it would be as simple as flagging when `apk upgrade` returns a failure.

Not sure if this is worth a blog post but for now, I'm just sending myself email notifications via msmtp's `sendmail` implementation.

Basically, I just wrote a small `notify` method, which sends an email. Then, I wedged it in a couple of places in my update-containers.sh, which is run by `cron`. The method looks something like this:

function notify() {
    msg="${1}"

    {
        echo From: cron@chromic.org
        echo To: chimo@chromic.org
        echo Subject: Cron failure
        echo
        echo "${msg}"
    } | sendmail -t -C /home/chimo/.msmtprc
}

This is temporary (famous last words and all) until I have time to implement something better (e.g.: send the contents of stderr via email when script exits with non-zero status, effectively decoupling notifications from the script itself. Or something, idk, we'll see).

Recent articles from blogs I follow

I think fedizens should be able to disable replies to some or all of their posts

Every so often, there is a bit of a debate in the fediverse about whether a person should be able to make a post to which other users cannot reply. Yes, they should My view is simple: yes, they should. It is no different to running a website and not offering…

via Neil's blog December 7, 2024

Adding Encrypted Swap and a Userspace OOM-Killer

When setting up my Ideapad, I didn't configure swap because I wanted to avoid reducing the (already unknown) lifetime of it's eMMC storage. This, however, has proven to be a mistake - the Ideapad only has 4GB of RAM and I'm quite good at accid…

via www.bentasker.co.uk December 7, 2024

Advent of Code: Day 4

Link to Day #4 puzzle.

via not just serendipity December 6, 2024