ansible-sendmail/templates/notify_unit_failure.sh

17 lines
300 B
Bash
Raw Normal View History

2021-02-23 18:49:29 +01:00
#!/usr/bin/env bash
INVOCATION_ID=$(systemctl show -p InvocationID --value ${1}.service)
cat << EOM | sendmail \
-section unit_failure \
-sub "[UNIT-FAILURE|$(hostname)] ${1}"
The unit ${1}.service just failed
Date: $(date)
---
$(journalctl _SYSTEMD_INVOCATION_ID=${INVOCATION_ID})
EOM