Optimize security updates check script and add customizable from address

This commit is contained in:
Alice Gaudon 2019-11-01 04:22:49 +01:00
parent da243f92d7
commit 6408d54edb
1 changed files with 5 additions and 4 deletions

View File

@ -9,11 +9,12 @@ fi
echo -e "$UPDATES"
HOST=$(hostname)
DEST=$(cat ~/.admin_mail)
if [ ! -z "$UPDATES" ]; then
echo -e "The following security updates are available for $HOST:\n\n$UPDATES\n\nIt is highly recommended that you perform these updates now" | mailx -s "Security updates are available on $HOST" $DEST
HOST=$(hostname)
FROM=$(cat ~/.host_mail)
DEST=$(cat ~/.admin_mail)
echo -e "The following security updates are available for $HOST:\n\n$UPDATES\n\nIt is highly recommended that you perform these updates now" | mailx -s "Security updates are available on $HOST" -r "$FROM" $DEST
echo "Mail sent"
fi