From 8eb5d639b995e85b4c69e0f77ff85064b0a50ace Mon Sep 17 00:00:00 2001 From: Miguel Date: Wed, 1 Aug 2018 12:57:52 +0200 Subject: added kvm tools and some simple scripts --- mail_apt_upgradable.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 mail_apt_upgradable.sh (limited to 'mail_apt_upgradable.sh') diff --git a/mail_apt_upgradable.sh b/mail_apt_upgradable.sh new file mode 100755 index 0000000..491addc --- /dev/null +++ b/mail_apt_upgradable.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# make sure sendmail works fine, E.g. ssmtp is very light and easy. +# crontab -e & add the following line to run every 6 hours: +# 0 */6 * * * /home/miguel/bin/mail_apt_upgradable.sh + +SUBJECT="$HOSTNAME : apt list --upgradeable" +MAIL="m.i@gmx.at" + +if [ "$#" -ne 1 ]; then + "$0" arg0 | sudo sendmail $MAIL + exit +fi + +echo "Subject: $SUBJECT" +echo "Hello Friend," +echo +echo "This is the automatic apt checker service." +echo +sudo apt-get update 1> /dev/null +echo "'apt update' exited with the return code: $?" +echo +echo "'apt list --upgradable -a' produced the following output:" +echo +echo "--- START ---" +apt list --upgradable -a 2>/dev/null +echo "--- END ---" +echo +echo "Best regards," +echo "Your FoolBot" -- cgit v1.2.3