Welcome!
Thanks for visiting. If you found this information interesting or useful (or you think I'm dead wrong about something) I'd like to invite you to leave a comment on this post. You can also
subscribe to my RSS feed or sign up for email updates on the right-hand side of the page.
If you Digg what you StumbleUpon, find my writing del.icio.us, or are one of the Technorati, you know what to do:
BackupPC only when mobile device / laptop is plugged in
I’m the proud owner of a Nokia N800 Internet Tablet (which I will, of course, write about later) and I’ve been getting around to doing a bit of hardware hackery now that the semester has ended. I wanted to integrate this tasty little Linux machine into my home backup system, which is powered by BackupPC. Unfortunately, running rsync and wireless eats up the battery pretty quickly. Thus, I rigged up this command, which will cause the backup to fail if the tablet is not plugged in.
$Conf{RsyncClientCmd} = '$sshPath -q -x -l root $host grep -q 0 /sys/power/sleep_while_idle && $rsyncPath $argList+';
The key is grep -q 0 /sys/power/sleep_while_idle which queries the kernel to see whether the CPU should sleep when it’s idle. When the N800 is plugged in, the value is 0, grep -q returns a non-zero exit code, and the backup proceeds. When the N800 is on battery, the value is 1, and the backup stops. The string /sys/power/sleep_while_idle is definitely hardware specific, and you’ll need to poke around /sys or /proc for an appropriate filename and value to grep for.
Related posts:
- Speed up laptop boot & resume times with large MySQL databases I'm in the interesting position of using my laptop for...
- Good directions on getting BackupPC working I recommend this set of directions for getting BackupPC working....
- NetworkManager problems in Ubuntu Dapper/Edgy Both Jennifer and I have had a problem with our...
- Reliable InnoDB hot backups There are number of blog posts out there that mention...
- Inspiron 5150 Owners - rejoice! I got a letter on Friday telling me that my...

