Here's my problem:
I have a laptop running Arch that I just keep on at home. It's got a good 4 hour battery life, but sometimes my daughter is playing near where it's kept and ends out pulling the plug. Well, when I get home 5 hours later, my laptop had a hard shutdown.
Additionally, sometimes I'll leave it suspended and forget about it for a day or so - same problem.
Here's my proposition:
So my thought was that I could make a cron job that runs every 15 or 30 minutes or something, checking the battery life. If the battery life is < N minutes left, I could just hibernate the laptop. This would work fine if my laptop is in normal 'on'. But if I'm suspended, not so much. So my question is two fold - is there a better way to do this, and if not, is it possible to do some sort of monitoring in suspend mode - basically just run that cron job?
Here's what worked:
wayne@jughead:~$ swapon -s Filename Type Size Used Priority /dev/sda2 partition 530140 56744 -1
/dev/sda2 was the name of my swap partition. So I set this in my
snapshot device = /dev/snapshot resume device = /dev/sda2
I added uresume in my mkinitcpio.conf here:
HOOKS="base udev autodetect pata scsi sata resume uresume filesystems usbinput fsck"
/etc/pm/config.d/module and put
Since my laptop was not recognized (
# s2ram --test displayed
Machine unknown) I had to use the
/usr/lib/pm-utils/module.d/uswsusp I also changed all of the
s2ram options to