Automatic updates in Mint 19

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Post Reply
User avatar
administrollaattori
Level 15
Level 15
Posts: 5653
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Automatic updates in Mint 19

Post by administrollaattori » Mon Nov 12, 2018 10:49 am

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 an AUTOUPDATE script:

Code: Select all

sudo nano /etc/AUTOUPDATE
… the contents

Code: Select all

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

Code: Select all

sudo chmod a+x /etc/AUTOUPDATE
2. Add the script to the systemd

Code: Select all

sudo nano /etc/systemd/system/autoupdate.service
… the contents

Code: Select all

[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

Code: Select all

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

Code: Select all

nano AUTOUPDATE-NOTIFICATION
… a contents

Code: Select all

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

Code: Select all

chmod +x AUTOUPDATE-NOTIFICATION
… and for user´s crontab

Code: Select all

crontab -e
… add a line

Code: Select all

@reboot export DISPLAY=:0 && sleep 60 && cd /home/username_here && ./AUTOUPDATE-NOTIFICATION
… save and quit
Ctrl o
Ctrl x
.... command xdpyinfo | grep display tell the display(s)
For getting dialog working, install Xterm

Code: Select all

apt install xterm
For scrolling dialog, use arrow keys

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.

Image

Post Reply

Return to “Tutorials”