Browse Source

Write cron script to hibernate if notebook has low battery.

Drew 12 năm trước cách đây
mục cha
commit
1152c4655f
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  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