]> git.somenet.org - root/pub/somesible.git/blob - roles/base/systemd/fail-mail/files/default/systemd-unit-status-mail.sh
roles/service/nextcloud/tasks
[root/pub/somesible.git] / roles / base / systemd / fail-mail / files / default / systemd-unit-status-mail.sh
1 #!/bin/bash
2 ################################################
3 ### Managed by someone's ansible provisioner ###
4 ################################################
5 # Part of: https://git.somenet.org/root/pub/somesible.git
6 # 2017-2024 by someone <someone@somenet.org>
7 #
8
9 UNITSTATUS=$(systemctl status -n1000000000 "$1")
10
11 sendmail $2 <<EOF
12 From:systemd-unit-status-mailer<root@$3>
13 To:<$2@$3>
14 Subject:systemd <$2@$3> ($1)
15
16 $UNITSTATUS
17 EOF
18
19 echo -e "Mail report sent to: $2 for unit: $1"