From da243f92d708c4e87d9dfb240d9885d8f3dba1a6 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Fri, 1 Nov 2019 04:13:47 +0100 Subject: [PATCH] Add security-updates-check.sh script (sends mail notifications) --- security-updates-check.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 security-updates-check.sh diff --git a/security-updates-check.sh b/security-updates-check.sh new file mode 100755 index 0000000..7907e83 --- /dev/null +++ b/security-updates-check.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +UPDATES=$(arch-audit --upgradable | sed "{s/\n/
/g}") + +if test "$1" != "true" +then + UPDATES=$(echo -e "$UPDATES" | grep -v "testing repos\!") +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 + echo "Mail sent" +fi +