1. Install and configure cron-apt
1 | # apt-get install cron-apt bsd-mailx ssmtp # Or msmtp |
We want only be notified of new updates. We want not to install them automatically. All settings are optimal for this action by default. And the cronjob will also run every day 4am by default. All you have to change in /etc/cron-apt/config is the following:
1 2 | MAILTO="user@example.com" MAILON="upgrade"Â Â Â Â #to only be notified if updates are avaiable |
2. Be notified
To be notified via mailx, you have to copy the 9-notify from examples to actions.d and edit them.
1 | # cp /usr/share/doc/cron-apt/examples/9-notify /etc/cron-apt/action.d/ |
1 2 | # vi /etc/cron-apt/action.d/9-notify -q -q --no-act upgrade MAILON=user@example.com |
3. Configure ssmtp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # # Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=someuser@thebc.ch # The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.com mailhub=mailbox.thebc.ch        # Or the IP-address # Where will the mail seem to come from? #rewriteDomain= # The full hostname hostname=thisserver.thebc.ch # Are users allowed to set their own From: address? # YES - Allow the user to specify their own From: address # NO - Use the system generated From: address FromLineOverride=YES |
4. Check your installation
To check if all is working as you expect run:
1 | # cron-apt -s |