How to change the snapshot refresh (update) schedule

By default, the Snap package is set to refresh (update) 4 times a day, but this can be changed and this article will show you how to do it.
It should also be noted that you cannot completely disable the automatic update of snapshot packages directly from the snapshot settings, because there is no choice for this (how does this happen?), So if you want to completely disable this feature, you must resort to this workaround , Such as preventing the snapshot from updating the URL, or setting the Internet connection to metered and using refresh.metered Option to retain snapshot refresh process when metered connection is detected (sudo snap set system refresh.metered=hold).
Have a A long debate For this reason, you can choose to change the snapshot refresh schedule, but you cannot disable it completely.

To view the current snapshot refresh (update) schedule of the system, use:

snap refresh --time

This is the default:

$ snap refresh --time

timer: 00:00~24:00/4
last: today at 12:42
next: today at 23:30

To change the snapshot refresh schedule, use:

sudo snap set system refresh.timer=

You need to replace Use the snapshot refresh rate you want to set for the timer, such as Snapcraft documentationLet’s look at an example. Change the snapshot refresh timer to Friday only, sometime between 10:00 and 12:00:

sudo snap set system refresh.timer=fri,10:00~12:00

To verify that it works, run snap refresh --time once again. This time it will show a new timer and a new time to schedule the next update:

$ snap refresh --time
timer: fri,10:00~12:00
last: today at 12:42
next: in 2 days, at 11:10

Do you want to set the snapshot refresh schedule back to the default (4 times a day)? run:

sudo snap set system refresh.timer=00:00~24:00/4

Some other time / frequency examples:

  • tue,fri Tuesday and Friday 00:00
  • tue,10:00,,fri,12:00 Tuesday 10:00 and Friday 12:00
  • sat5 00:00 on the last Saturday of the month
  • 8:00 Every day at 8:00
  • mon-fri,9:00-11:00/2 Monday to Friday, twice between 9:00 and 11:00

You may also be interested in how to delete old snapshot versions to free up disk space.
It’s worth noting that for snapshot versions older than 2.32.d you need to use core Instead system In the command, it becomes sudo snap set core refresh.timer=. Also, for snapshot versions earlier than 2.31, you need to replace refresh.timer versus refresh.schedule. However, most systems should have a newer snapshot version (for example, all supported Ubuntu versions have a newer version).

Source

Sidebar