Install update-notifier:

sudo apt-get install update-notifier

You can see here how to make the mail part work. Save the script and make it executable with “chmod +x script.sh”:

updates=$(/usr/lib/update-notifier/apt-check 2>&1)

pending=$(echo "${updates}" | cut -d ";" -f 2)
if [ "$pending" != "0" ]; then
    echo "${pending} security update(s) pending." | mail -s "Security update pending" example@example.me
    exit
fi

pending=$(echo "${updates}" | cut -d ";" -f 1)
if [ "$pending" != "0" ]; then
    echo "${pending} non-security update(s) pending." | mail -s "Non-Security update pending" example@example.me
fi

Open crontab:

crontab -e

Add a line that executes the script as often as you like. In this case it is executed once a day at 5:00.

* 5 * * * bash /path/to/your/script.sh
⤧  Next post Send Emails from the Command-line ⤧  Previous post Wikipedia context menu search Firefox addon