#!/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"