瀏覽代碼

Write cron script to hibernate if notebook has low battery.

Drew 12 年之前
父節點
當前提交
1152c4655f
共有 1 個文件被更改,包括 6 次插入0 次删除
  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