Browse Source

Write cron script to hibernate if notebook has low battery.

Drew 12 years ago
parent
commit
1152c4655f
1 changed files with 6 additions and 0 deletions
  1. 6 0
      scripts/auto-hibernate.sh

+ 6 - 0
scripts/auto-hibernate.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+
+batperc=$(cat /sys/class/power_supply/BAT0/uevent | grep CAPACITY | cut -f2 -d=)
+if [[ $batperc -eq "2" ]]; then
+  /usr/bin/systemctl hibernate
+fi