[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cron startup bug (3.0r2 on Dell 8600/2.4.24)



A. F. Cano wrote:

This might be old news to everyone else, but I didn't see any reference
to it while I was tracking down the problem.

Log files were not being rotated, so I started backtracking to find out
why.  It turns out that Anacron wasn't being started because of a bug in
/usr/bin/on_ac_power.  This script checks if the AC power is on, and if
it is not, does not start anacron.  It turns out that the ACPI file it
checks is not the correct one, and so anacron never starts, even when on
AC power.  The following snippet of code is what's in the standard
distribution (3.0r2):

acpi_available && [ -r /proc/acpi/ac_adapter/0/status ] && {
  grep on-line /proc/acpi/ac_adapter/0/status >/dev/null 2>&1 && exit 0
  grep off-line /proc/acpi/ac_adapter/0/status >/dev/null 2>&1 && exit 1

It should be replaced with the following

acpi_available && [ -r /proc/acpi/ac_adapter/AC/state ] && {
  grep on-line /proc/acpi/ac_adapter/AC/state >/dev/null 2>&1 && exit 0
  grep off-line /proc/acpi/ac_adapter/AC/state >/dev/null 2>&1 && exit 1

as that is the real location of the ACPI file (at least for kernel 2.4.24).

Unfortunately, your analysis is incorrect.

/proc/acpi/ac_adapter/AC/state is the correct location _for your machine_. The name of the AC adapter (and batteries, buttons, etc) is determined by the tables in your BIOS. iirc, on my laptop it's AC0. A more correct implementation of on_ac_power would be to find what files match /proc/acpi/ac_adapter/*/state. There's a possibility that there can be more than one such file - though I don't know if it's ever true of a machine that would care about on_ac_power (typically used on machines that are intended as servers).
--
derek



Reply to: