server-scripts/security-updates-check.sh

18 lines
476 B
Bash
Raw Normal View History

#!/bin/sh
UPDATES=$(arch-audit --upgradable --show-testing | sed "{s/\n/<br>/g}")
if test "$1" != "true"
then
2020-04-07 00:11:56 +02:00
UPDATES=$(echo -e "$UPDATES" | grep -v "testing repos\!")
fi
2020-02-02 06:47:47 +01:00
echo -en "$UPDATES"
if [ ! -z "$UPDATES" ]; then
HOST=$(hostname)
2020-02-02 06:47:47 +01:00
echo -e "The following security updates are available for $HOST:\n\n$UPDATES\n\nIt is highly recommended that you perform these updates now" | $(dirname $0)/mail.sh "Security updates are available on $HOST"
echo "Mail sent"
fi