Open Jaymon opened 5 years ago
Turns out Chef's apt_package resource has a frequency property, so you could do this:
apt_package "update packages" do
action :periodic
frequency 86400 * 30 # every 30 days
end
I was going to change it end of March 2020 but decided against it because we use the sentinel files for the other package recipes also and so I left everything as is
Right now
package::update
creates a temp file to decide if it should run again, today I found outapt-get
already does that with/var/lib/apt/periodic/update-success-stamp
, you can check the modified date to see when it was last run (the file itself is empty).It would also be cool if
package::update
could monitor/etc/apt/sources.list
or/etc/apt/sources.list.d
and if those were changed since it was last run it would go ahead and run itapt-get update
anyway regardless of when it was last run, this could be done by keeping my sentinel file but adding values like how many files are insources.list.d
and the md5 hash ofsources.list
and if either of those are different it would run it againhttp://manpages.ubuntu.com/manpages/trusty/man1/add-apt-repository.1.html