The operating system my web server runs on is (include version): ubuntu 18.04
My hosting provider, if applicable, is:
I can login to a root shell on my machine (yes or no, or I don’t know): yes
I’m using a control panel to manage my site (no, or provide the name and version of the control panel): no
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot): 0.28
When running regular certbot renewal from cron I can get error output easily to email (cron sends output on email). How can I achieve the same functionality when running it as a systemd service? Thank you
Roman
#!/usr/bin/env bash
set -u
# EXIT_STATUS is set by systemd when this script is invoked
# https://www.freedesktop.org/software/systemd/man/systemd.service.html#ExecStopPost=
if [ "$EXIT_STATUS" != "0" ]; then
mail -s "Let's Encrypt renewal failed" user@example.com
fi
(Make sure it’s executable).
Completely untested but who knows, it might be what you need.