Package: backupninja
Severity: wishlist
Tags: patch
When using backupninja on a laptop, it would be nice to be able to
choose to not run certain jobs when off AC power. I don't want to use
my limited battery power running a backup, I'd rather wait until I
plug the system in.
I have modified backupninja to check if a job is not supposed to be
run on battery power, and if not, if the system is on battery power.
It checks for a "runonbattery" option (which defaults to "yes") in the
main section of each backup job's config file in /etc/backup.d, and
uses "acpi -a" and grep to check the power status.
I'm not sure of the right way to supply a diff, so I will attach
/usr/sbin/backupninja, changed from 0.9.4-6ubuntu4 (on my laptop,
which runs Ubuntu...Debian on my desktop, but I don't run it without
it being plugged in, of course). The changes are the adding of lines
276-291. Then the default config file should be updated, and
ninjahelper too, I guess, though that's over my head right now.
Hi Adam,
Sorry for the delayed response.
* Adam Porter <[email protected]> [2008-02-16 23:41-0500]:
>
> When using backupninja on a laptop, it would be nice to be able to
> choose to not run certain jobs when off AC power. I don't want to use
> my limited battery power running a backup, I'd rather wait until I
> plug the system in.
This is a very good idea.
> I have modified backupninja to check if a job is not supposed to be
> run on battery power, and if not, if the system is on battery power.
> It checks for a "runonbattery" option (which defaults to "yes") in the
> main section of each backup job's config file in /etc/backup.d, and
> uses "acpi -a" and grep to check the power status.
Good approach, we will need to Recommend/Suggest on the package that
includes the /usr/bin/acpi binary (acpi).
> I'm not sure of the right way to supply a diff, so I will attach
> /usr/sbin/backupninja, changed from 0.9.4-6ubuntu4 (on my laptop,
> which runs Ubuntu...Debian on my desktop, but I don't run it without
> it being plugged in, of course). The changes are the adding of lines
> 276-291. Then the default config file should be updated, and
> ninjahelper too, I guess, though that's over my head right now.
It doesn't look like there was anything attached to this. The best way
to provide a diff would be to take the most current version from the svn
trunk and do a unified diff against that and then send that.
Thanks for doing this, I think it would be a very useful feature addition
Micah
Subject: Re: Bug#466193: Skip job while on battery power option
Date: Sun, 22 Jun 2008 23:29:13 +0200
Hello,
> Sorry for the delayed response.
What should I say, then...
> * Adam Porter <[email protected]> [2008-02-16 23:41-0500]:
>>
>> When using backupninja on a laptop, it would be nice to be able to
>> choose to not run certain jobs when off AC power. I don't want to use
>> my limited battery power running a backup, I'd rather wait until I
>> plug the system in.
> This is a very good idea.
Agreed.
>> I have modified backupninja to check if a job is not supposed to be
>> run on battery power, and if not, if the system is on battery power.
>> It checks for a "runonbattery" option (which defaults to "yes") in the
>> main section of each backup job's config file in /etc/backup.d, and
>> uses "acpi -a" and grep to check the power status.
> Good approach, we will need to Recommend/Suggest on the package that
> includes the /usr/bin/acpi binary (acpi).
Well, that’s a good starting point, but... a bit too ad-hoc for my
taste. There are not only ACPI laptops, but also APM, PMU, and maybe
some more. IMHO, a more generic way should be used to tell if the box
is running on battery power.
Does Debian, or the Linux kernel, already provides a generic interface
for this ? If not, maybe another program / lib already does this.
If not, we may have to invent our own wheel.
>> I'm not sure of the right way to supply a diff, so I will attach
>> /usr/sbin/backupninja, changed from 0.9.4-6ubuntu4 (on my laptop,
>> which runs Ubuntu...Debian on my desktop, but I don't run it without
>> it being plugged in, of course). The changes are the adding of lines
>> 276-291. Then the default config file should be updated, and
>> ninjahelper too, I guess, though that's over my head right now.
> It doesn't look like there was anything attached to this. The best way
> to provide a diff would be to take the most current version from the svn
> trunk and do a unified diff against that and then send that.
Adam’s modified script[1] has been attached to the related Launchpad
entry[2].
[1] http://launchpadlibrarian.net/12045160/backupninja
[2] https://bugs.launchpad.net/ubuntu/+source/backupninja/+bug/192560
Bye,
--
intrigeri <[email protected]>
| clé gnupg @ http://gaffer.boum.org/intrigeri/intrigeri.asc
| Que signifie ce pardon que tu me demandes ?
| Faut-il toujours que tu cherches à être jugé-e ?
Subject: Re: Bug#466193: Skip job while on battery power option
Date: Mon, 23 Jun 2008 16:44:57 +0200
Hello again,
intrigeri wrote (22 Jun 2008 21:29:13 GMT) :
> Well, that’s a good starting point, but... a bit too ad-hoc for my
> taste. There are not only ACPI laptops, but also APM, PMU, and maybe
> some more. IMHO, a more generic way should be used to tell if the box
> is running on battery power.
> Does Debian, or the Linux kernel, already provides a generic interface
> for this ? If not, maybe another program / lib already does this.
> If not, we may have to invent our own wheel.
The powermgmt-base package contains a /sbin/on_ac_power shell script
that manages ACPI, PMU and APM. The issue is... in case of ACPI, it
looks for the /proc/acpi/ac_adapter directory, that does not exist on
my desktop machine, and thus exits with code 255 (i.e. « Power status
could not be determined », according to the manpage).
Adam’s solution has the same issue :
$ acpi -a
No support for device type: battery
No support for device type: ac_adapter
$ acpi -a | grep 'on-line'
$
I don’t know if this is specific to the two desktop boxes I’ve run
these tests on, but it seems that non-laptop boxes have no way to tell
if they are running on AC power... which seems quite logical, since
they obviously are.
My proposal is then to :
- use the runonbattery option suggested by Adam, defaulting to "yes"
as Adam’s did
- in case runonbattery is set to "no", use powermgmt-base’s
on_ac_power script to determine if the box is running on battery
- suggest the powermgmt-base package
- well-document the dependancy of runonbattery option on
powermgmt-base package
A thing I’m not sure about is : do we really want to make this option
a per-job one ? It adds a bit of complexity to the user-configuration
that I’m not sure we want to add. Adam, could you please provide us
with an example of which jobs you may want to run on battery, and
which ones you don’t ?
Bye,
--
intrigeri <[email protected]>
| gnupg key @ http://gaffer.boum.org/intrigeri/intrigeri.asc
| So what?
Subject: Re: Bug#466193: Skip job while on battery power option
Date: Tue, 05 Jan 2010 15:23:45 +0100
Hi,
Adam Porter wrote (17 Feb 2008 07:32:24 GMT) :
> When using backupninja on a laptop, it would be nice to be able to
> choose to not run certain jobs when off AC power. I don't want to
> use my limited battery power running a backup, I'd rather wait until
> I plug the system in.
Until someone comes up with a mergeable patch, please note the new
"halt" function can be used in a .sh handler to abort all backups
unless $CONDITION is not met.
Bye,
--
intrigeri <[email protected]>
| GnuPG key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc
| OTR fingerprint @ https://gaffer.ptitcanardnoir.org/intrigeri/otr-fingerprint.asc
| Do not be trapped by the need to achieve anything.
| This way, you achieve everything.
Debbugs is free software and licensed under the terms of the GNU General
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.