Bug 919769 - dnf runs makecache hourly despite laptop power state
Summary: dnf runs makecache hourly despite laptop power state
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ales Kozumplik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-10 01:35 UTC by William Brown
Modified: 2014-09-30 23:41 UTC (History)
2 users (show)

Fixed In Version: dnf-0.3.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-03-26 15:27:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description William Brown 2013-03-10 01:35:40 UTC
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:

#! /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
    fi
fi

LOGFILE=/var/log/dnf-makecache.cron
STAMP=`date +%c`:
echo $STAMP >>$LOGFILE
/usr/bin/dnf makecache >>$LOGFILE

Comment 1 Ales Kozumplik 2013-03-26 14:26:32 UTC
(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).

Comment 2 Ales Kozumplik 2013-03-26 15:27:20 UTC
> 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
>     fi
> fi
> 
> LOGFILE=/var/log/dnf-makecache.cron
> 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').


Note You need to log in before you can comment on or make changes to this bug.