I have to admit that this post is heavily influenced by OMG! Ubuntu! How to disable automatic updates on ubuntu. Therefore instead of me effectively reproducing the content here, I would urge you to read that post for the instructions on how to disable automatic updates on ubuntu.
points out in the post, that disabling automatic updates in ubuntu is not a recommended and that users who seek to disable this functionality should have an alternative work flow.Â There are legitimate reasons why users would want to disable this functionality i.e. conserving bandwidth being one of them. I frequently run into this situation with my laptop that I use to travel with.Â When I connect to the internet via GSM and when travelling i.e. in Europe and having to contend with roaming charges, I don't really want to download 300MB of updates. I prefer to wait till I am in a free Wifi zone to do updates.
Over the years I have adapted my morning work flow, to do my updates as soon as I log on in the morning. Therefore I have created a simple BASH Script that I execute.[ebs_panel style="panel-info"] [ebs_panel-header] [ebs_icon type="glyphicon glyphicon-download-alt" color="#1e73be"] Download BASH Script
[/ebs_panel-header] [ebs_panel-content] [wpdm_package id='6298'] [/ebs_panel-content] [ebs_panel-footer] How to execute BASH Scripts
I save this file to my Home Directory and as part of my morning routine,Â I open up twitter and catch up on OMG! Ubuntu articles, is I simply alsoÂ open a terminal window and type
My updates then run in the background.
The simplified version of this script is as follows
#!/bin/bash echo "Updating repositories and upgrading any packages" apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y echo "Remove any deprecated packages" apt-get autoremove -y echo "change to boot directory" ls /boot dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y while true; do read -p "Do you want to reboot ?" yn case $yn in [Yy]* ) reboot; break;; [Nn]* ) exit;; * ) echo "Please answer yes or no.";; esac done