Parcourir la source

Write cron script to hibernate if notebook has low battery.

Drew il y a 12 ans
Parent
commit
1152c4655f
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  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