From 6408d54edbd0344d72936be377f0b0a575b45bb8 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Fri, 1 Nov 2019 04:22:49 +0100 Subject: [PATCH] Optimize security updates check script and add customizable from address --- security-updates-check.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/security-updates-check.sh b/security-updates-check.sh index 7907e83..0106ff9 100755 --- a/security-updates-check.sh +++ b/security-updates-check.sh @@ -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