Ubuntu – How to ban Software Updater from checking for updates at certain times of day or certain days of week

18.04update-managerupdates

I would like to find some way to stop Software Updater for checking for updates except during time periods I specify. The problem with it is that it hogs system resources and if I am watching video it totally destroys the video playback while it is running. So I would like to specify a time of day when it is allowed to run, and ban it from running at any other time.

I found an article at https://www.omgubuntu.co.uk/2016/02/how-to-disable-automatic-update-ubuntu that shows how to disable automatic updates completely, but that's not what I want to do. However it occurs to me that if I knew what it was changing (I assume it changes a configuration file somewhere?) I could perhaps use a small bash script to rewrite that value at a specific time using a cron job. In other words, in step 4 of that article's instructions, where it says "Change ‘Automatically check for updates’ from ‘Daily’ to ‘Never‘", I'd like to know where the setting that is being changed is found (what configuration file, or however it's stored).

Alternately if that's not a possible way to do it then I'd like to know what program or script Software Updater actually runs to do the update. My assumption is that Software Updater is only the GUI portion of the process, but that if there is a daily check for updates that check has to be triggered by something and it has to be running some script or program that actually goes out and checks for updates and then downloads them. My thought is that if it's a script I could modify it to check the time of day and refuse to run if it's in the "banned" time period. Or if it's a program, maybe I could move it to some directory where whatever runs it could not find it at the start of the "banned" period, then move it back at the end. Or maybe there is a solution I am not considering here.

Please understand that I DO want to be notified by Software Updater when updates are available, and preferably I DO want it to check for updates daily, just not during a certain period of time during the day. I do know how to use sudo apt update and sudo apt upgrade from a command prompt but I don't want to have to do that every day, and while I realize that those could be run as a cron job I don't want to install any updates automatically, instead I do want Software Updater to notify me that I have updates and let me install them.

Or maybe I am asking entirely the wrong question here, and maybe what I should be asking is how Software Updater determines what time of day to check for updates in the first place. When I was running Ubuntu 14.04 it always seemed to check in the early afternoon which was fine, but in Ubuntu 18.04 it seems to think that right in the middle of prime time TV is when it should be checking. Anyway hopefully I have adequately explained the problem.

The tl;dr version:

I do NOT want to disable Software Updater completely, and I do NOT want to have to do manual software updates from a command prompt, nor do I want any unattended automatic software installs using cron jobs. I just want to know how to stop Software Updater from checking for updates during TV prime time, without shutting off updates completely.

Best Answer

Please have a look on below images.
to access in your system please install dconf-editor.
to install it sudo apt update && sudo apt install dconf-editor

enter image description here enter image description here enter image description here

Please note that, for security updates, there is no control. Please have a look at below description.

<key type="i" name="regular-auto-launch-interval">
  <default>7</default>
  <summary>Interval (in days) when to auto launch for normal updates</summary>  
  <description>The interval (in days) when auto launching update-manager for   normal updates. Please note that it will auto launch for security updates   immediately. If you set it to "0" it will also launch as soon as updates become   available.</description>

Based on your needs you can control those three choices with command line as below commands

gsettings set com.ubuntu.update-notifier no-show-notifications true
gsettings set org.gnome.software download-updates false
gsettings set org.gnome.software allow-updates false

now, Based on your needs, you can set cronjob (How do I set up a Cron job?) with true and false values for your chosen time..

for example. 6pm to 10pm is the PRIME TV PROGRAMME,

then set the 3 values scheduled at 6pm true/ false
and then set the 3 values scheduled at 10pm false/ ture