#!/bin/bash
################################################
### Managed by someone's ansible provisioner ###
################################################
# Part of: https://git.somenet.org/root/pub/somesible.git
# 2017-2026 by someone <someone@somenet.org>
#

UNITSTATUS=$(systemctl status -n1000000000 "$1")

sendmail $2 <<EOF
From:systemd-unit-status-mailer<root@$3>
To:<$2@$3>
Subject:systemd <$2@$3> ($1)

$UNITSTATUS
EOF

echo -e "Mail report sent to: $2 for unit: $1"
