--- /dev/null
+# Copyright (c) 2023 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+
+[Unit]
+Description=Notify about failure through an email notification.
+
+[Service]
+Type=oneshot
+ExecStartPre=/usr/bin/git \
+ --work-tree=/tmp \
+ --git-dir=/srv/git/cron.git \
+ checkout main --force notify_on_failure.sh
+ExecStart=/tmp/notify_on_failure.sh %I
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null
+#!/bin/sh
+# Copyright (c) 2023 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+
+MAILTO="server@${private_domain}"
+MAILFROM="server@${private_domain}"
+UNIT=${1}
+
+/usr/sbin/sendmail ${MAILTO} <<EOF
+From:${MAILFROM}
+To:${MAILTO}
+Subject:Status mail for unit: ${UNIT}
+
+$(journalctl --unit=${UNIT} \
+ --since="10 minute ago" \
+ --output=short-iso \
+ --no-hostname \
+ --no-pager)
+EOF