Automatic updates in Mint 19

Automatic updated is not a recomment way to upgrade system, because if user interrupts the process, system can be borked. Anyway if wanting to use automatic updates, it can do many ways, and here is one way.

1. Make a AUTOUPDATE script:
sudo nano /etc/AUTOUPDATE

… the contents

#!/bin/bash
## Automatic updates in Mint 19
sleep 60
/usr/bin/mintupdate-cli upgrade --refresh-cache --yes --only-levels 1,2,3 && /usr/bin/mintupdate-cli upgrade --only-security && /usr/bin/mintupdate-cli upgrade --yes --only-kernel >> /var/log/mintupdate.log
exit 0

…. save, quit and make executable

Ctrl o
Ctrl x

sudo chmod a+x /etc/AUTOUPDATE

If not wanting install Kernel updates, AUTOUPDATE script goes

#!/bin/bash
## Automatic updates in Mint 19
sleep 60
/usr/bin/mintupdate-cli upgrade --refresh-cache --yes --only-levels 1,2,3 && /usr/bin/mintupdate-cli upgrade --only-security > /var/log/mintupdate.log
exit 0

2. Add the script to the systemd

sudo nano /etc/systemd/system/autoupdate.service

… the contents

[Unit]
Description=My autoupdate script that requires network
After=network.target

[Service]
Type=oneshot
ExecStart=/etc/AUTOUPDATE

[Install]
WantedBy=multi-user.target

…. save, quit and enable process

sudo systemctl daemon-reload
sudo systemctl enable autoupdate.service

3. It is good to know what is happened, so an another notification script can be added to the startup applications or user crontab. If using user´s crontab it goes like

nano AUTOUPDATE-NOTIFICATION

… a contents

#!/bin/bash
sleep 150
xterm -geometry 120x100 -fn 7x14 -e dialog --title "UPDATE HISTORY - SCROLL USING ARROWS UP AND DOWN" --textbox /var/log/apt/history.log 40 100
exit 0

…. save, quit and make executable
Ctrl o
Ctrl x
chmod +x AUTOUPDATE-NOTIFICATION

… and for user´s crontab

crontab -e

… add a line

@reboot export DISPLAY=:0 && sleep 60 && cd /home/username_here && ./AUTOUPDATE-NOTIFICATION

… save and quit
Ctrl o
Ctrl x

Command xdpyinfo | grep display tells display’s number

for getting dialog working, install Xterm

apt install xterm

Edit: If you have Chrome and/or Opera installed, them have changed their reporisities, and mintupdate requires user to accept that change, so you need to run apt update and answer yes (y) when asking, so autoupdate is working again.

For scrolling dialog, use arrow keys