Red Hat Bugzilla – Bug 919769
dnf runs makecache hourly despite laptop power state
Last modified: 2014-09-30 19:41:08 EDT
Description of problem:
dnf has a cron job in: /etc/cron.hourly/dnf-makecache.cron
The runs a makecache hourly.
On a laptop system this is quite draining. Additionally, hourly rebuilds are quite aggressive, this should be daily.
The script should be more like 0anacron in that:
# Do not run jobs when on battery power
if test -x /usr/bin/on_ac_power; then
/usr/bin/on_ac_power &> /dev/null
if test $? -eq 1; then
echo $STAMP >>$LOGFILE
/usr/bin/dnf makecache >>$LOGFILE
(In reply to comment #0)
> Additionally, hourly rebuilds are
> quite aggressive, this should be daily.
Please see bug 892064 for this particular issue. The time to check for expired metadata has been increased to 3 hours. That doesn't mean they are redownloaded and the cache rebuilt every three hours, only when the metadata actually expire (which is even as little as 6 hours for some repos, with notable example of Fedora Updates).
> The script should be more like 0anacron in that:
> #! /bin/bash
> # Do not run jobs when on battery power
> if test -x /usr/bin/on_ac_power; then
> /usr/bin/on_ac_power &> /dev/null
> if test $? -eq 1; then
> exit 0
> STAMP=`date +%c`:
> echo $STAMP >>$LOGFILE
> /usr/bin/dnf makecache >>$LOGFILE
Fixed by 04d030a, the automatic metadata syncing will never run whenver on a battery system, starting with dnf-0.3.1.
Thanks for the report and a nice tip towards a solution (didn't know about 'on_ac_power').