I have a backup script which is run daily by Anacron. It can take around 3 hours to complete.

I'm happy for Anacron not to commence the script if the laptop is running on batteries, but once started, I don't want it to be terminated if battery mode commences, since doing so leaves me with an incomplete backup and a false sense of security. The backup uses rsnapshot, which rotates the backups.

How can I disable Anacron's monitoring of power mode for running jobs (or otherwise work around this behaviour)?

I'm running Kubuntu 12.04.2.


Found this blog post titled: Linux: Anacron tips, which describes how to block anacron from getting killed when the power state is on battery:

excerpt from blog post

IMPORTANT: If your are using anacron on a laptop, anacron will stop (get killed) when running on battery and your scripts will not get executed. This is the default behavior, to save battery.

To change this do the following:

sudo gedit /usr/lib/pm-utils/power.d/anacron

and change to:

case $1 in
 start -q anacron || :
 start -q anacron || :
  • Perfect. Thank you. Searched for hours and couldn't find that. – Peter Snow May 30 '13 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.