×

Pages

Labels

Search

×

Pages

×
×

Notice

The site is currently undergoing scheduled maintenance, and may not function correctly. Please come back later.

Advertisement

advertisement

How To Prevent Snap From Automatically Updating

[WARNING]
This document is considered a work in progress. It may contain inaccurate, or incomplete information. DO NOT TRUST THE INFORMATION IN THIS DOCUMENT WITHOUT FIRST VERIFYING IT WITH APPROPRIATE RESOURCES!
[/WARNING]


Snap automatically refreshes (updates) snaps. It does this by default, and there is no built in option to disable this. A work-around is to create a cron job which adjusts the refresh settings for Snap so that Snap always misses it's window of opportunity.

Steps:
- Configure the Snap refresh timer so that it only refreshes once a month, on the last Friday, between 1:00AM - 2:00 AM. Type "sudo snap set system refresh.timer=fri5,01:00-02:00".
- Create a script which changes Snap's refresh timer settings to 6:00 AM-7:00AM. Create a new file called "snap_timer_forward.sh" in "/scripts", and in it paste:
[quote]
snap set system refresh.timer=fri5,06:00-07:00
[/quote]
- Give the script execution permissions for the root user. Type "chmod u=rwx,g=rx,o=r /scripts/snap_timer_forward.sh".
- Create a script at which changes Snap's refresh timer settings back to 1:00AM-2:00AM. Create a new file called "snap_timer_backward.sh" in "/scripts", and in it paste:
[quote]
snap set system refresh.timer=fri5,01:00-02:00
[/quote]
- Give the script execution permissions for the root user. Type "chmod u=rwx,g=rx,o=r /scripts/snap_timer_backward.sh".
- Create a Cron job which runs snap_timer_forward.sh every day at 12:00AM. Type "sudo -i", "crontab -e", type "1" (for Nano), press "enter", press "down arrow" until you reach the first empty line, paste "00 06,07 * * * /scripts/snap_timer_forward.sh". To save press "control" + "x", type "y", press "enter".
- Create a Cron job which runs snap_timer_backward.sh every day at 3:00AM. Type "sudo -i", "crontab -e", type "1" (for Nano), press "enter", press "down arrow" until you reach the first empty line, paste "00 01,02 * * * /scripts/snap_timer_forward.sh". To save press "control" + "x", type "y", press "enter".

Notes:
- Cron runs daily instead of only on the last Friday of the month, because there is no Cron option for that as far as I know (but I'm not very experienced with Cron).
- To check when Snap last refreshed, and will next refresh type "snap refresh --time".
- To check cron jobs schedules for a particular user (eg: "root") use "sudo crontab -u $user_name -l".
- These steps were tested on Lubuntu 18.04 AMD64. [WARNING THESE STEPS HAVE NOT BEEN FULLY TESTED BECAUSE LUBUNTU 18.04 REFUSES TO ALLOW ME TO CHANGE THE DATE AND TIME OF THE SYSTEM REGARDLESS OF THE METHOD I USE. I CHANGE IT, AND LUBUNTU CHANGES IT BACK A FEW SECONDS LATER.]
- Older versions of Snap are known to be incompatible with these steps, because those versions of Snap lack the required command options.

Authors:James Daniel Marrs Ritchey
License:Ritchey Permissive License v8
Ritchey Permissive License v8:

You means the person, or legal entity exercising permissions granted by this license. Provider means a person (or legal entity) using permissions granted by this license to share the material. Permissions are revoked permanently upon breach of this license. Subject to the terms of this license, any person (or legal entity) is hereby granted otherwise irrevocable royalty-free permission to do anything with material provided under this license. The material is provided as is, without warranties of any kind, guarantees of any kind, or implied fitness for any purpose. The authors, owners, and providers will not be held responsible for anything caused by the material. When sharing the material with others you take on all responsibilities of and relating to consequences (including warranties, implied warranties, guarantees, liabilities, and damages), including those which would normally be the responsibility of the owner, between you and those directly and indirectly receiving the material from you. The material must remain solely under this license. This license is to be upheld in Canada, subject to the laws of Canada, as they were on April 21, 2019. You must be legally capable of being bound to all the requirements of this license, and by using the material you agree to be. The license text is provided under these terms.

Advertisment

advertisement
Copyright © James Daniel Marrs Ritchey.

Siteviews