Commit Diff


commit - acff0d4ecc9b347a1a0a714783593be7057d10e7
commit + 0391bd759d46e4b93c51b30f0f92a5060e354ab2
blob - /dev/null
blob + 23daf7072cdcd2ccb47c76b4e3b43ede49c41226 (mode 755)
--- /dev/null
+++ battery
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+#
+
+## Debug
+#set -x
+
+BATT=$(apm | grep Battery | awk '{print $4}' | grep -o '[0-9]*')
+CONNECT=$(apm | grep connected | awk '{print $4}')
+
+if [ ${CONNECT} == 'connected' ]; then
+	exit
+else
+	echo "AC desconectado..."
+fi
+
+if [ ${BATT} -le '3' ]; then
+	env DISPLAY=':0.0' xmessage -fn '-*-*-*-r-*--0-100-0-0-p-*-iso8859-1' -timeout 5 "Se va apagar la laptop en 60 segundos"
+	sleep 60
+	doas /sbin/halt -p
+else
+	exit
+fi
+