Email about available updates with cron-apt
A quick tip on how to send an automatic email notification about available application updates on a Debian VPS.
-
Create a Gmail account dedicated to sending notifications.
-
Enable 2-factor authentication on the Gmail account.
-
Create a new app password through the web interface. Make sure to note down the password as it’s only showed once. Write down the password without the spaces, as these are not actually part of the password itself but just a visual help for reading it.
-
Install cron-apt:
sudo apt install cron-apt
- Edit cron-apt settings:
sudo nano /etc/cron-apt/config
And paste in the following, replacing email@example.com with the email address you’d like to receive notifications on:
MAILON="always"
MAILTO="email@example.com"
- Edit SSMTP configuration:
sudo nano /etc/ssmtp/ssmtp.conf
And paste in the following, replacing server@gmail.com with the Gmail email address you set up earlier, and abcdefghijklmnop with the application key:
root=server@gmail.com
mailhub=smtp.gmail.com:465
FromLineOverride=YES
AuthUser=server@gmail.com
AuthPass=abcdefghijklmnop
UseTLS=YES
- Test that cron-apt is working through the following command:
sudo /usr/sbin/cron-apt
An email message should be sent to the email address you picked in cron-apt configuration.