ANACRON_RUN_ON_BATTERY_POWER setting does not work

Bug #1050443 reported by Fumihito YOSHIDA
This bug affects 3 people
Affects Status Importance Assigned to Milestone
anacron (Ubuntu)

Bug Description

Configuration of ANACRON_RUN_ON_BATTERY_POWER does not work on Ubuntu(upstart native job) environment.

/usr/share/doc/anacron/README.Debian said:

  "By default, anacron does not run while on battery power. See /etc/default/anacron to change that."

And, default /etc/default/anacron are:
# If set to "yes", start anacron even when on battery power. By
# default, the /etc/init.d/anacron script tries to avoid running
# anacron unless on AC power, so as to avoid running down the battery.
# (Things like the locate updatedb cause a lot of I/O.)


But this feature does not work at all, because ANACRON_RUN_ON_BATTERY_POWER are implemented by sysv init scripts(debian/init.d).

debian/init.d has below, but /etc/init/anacron.conf did not care it.
    if test x"$ANACRON_RUN_ON_BATTERY_POWER" != x"yes" && test -x /usr/bin/on_ac_power
        /usr/bin/on_ac_power >/dev/null
        if test $? -eq 1
          log_progress_msg "deferred while on battery power"
          log_end_msg 0
          exit 0

    # on_ac_power doesn't exist, on_ac_power returns 0 (ac power being used)
    # or on_ac_power returns 255 (undefined, desktop machine without APM)
    start-stop-daemon --start --exec /usr/sbin/anacron -- -s

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: anacron 2.3-19ubuntu1
ProcVersionSignature: Ubuntu 3.5.0-14.16-generic 3.5.3
Uname: Linux 3.5.0-14-generic i686
ApportVersion: 2.5.1-0ubuntu7
Architecture: i386
Date: Thu Sep 13 23:16:30 2012
InstallationMedia: Ubuntu 11.10 "Oneiric" - Build i386 LIVE Binary 20111014-16:01
 PATH=(custom, no user)
SourcePackage: anacron
UpgradeStatus: Upgraded to quantal on 2011-12-03 (285 days ago)
modified.conffile..etc.init.anacron.conf: [modified]
mtime.conffile..etc.init.anacron.conf: 2012-09-13T23:13:27.309295

Revision history for this message
Fumihito YOSHIDA (hito) wrote :
Revision history for this message
Salatiel (salatiel-filho) wrote :

Thats correct. I see the same problem.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in anacron (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers