An alternative to a graphical power manager is to create a simple daemon. To do that, create /usr/local/sbin/shutdown-if-low-battery with executable permissions containing this:
interval=120 critical_level=10 while true do if test "`acpi -a | grep -o off`" = "off" ; then battery_level=`acpi -b | sed 's/.*[dg], //g;s/\%,.*//g'` test $battery_level -le $critical_level && poweroff fi sleep $interval done
Then create /etc/init.d/shutdown-if-low-battery with executable permissions containing this:
### BEGIN INIT INFO # Provides: shutdown-if-low-battery # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Forces shutdown if battery is below 10% # Description: Forces shutdown if battery is below 10% ### END INIT INFO NAME=shutdown-if-low-battery DAEMON=/home/nick/.local/bin/$NAME PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME case "$1" in start) start-stop-daemon --background --start --quiet --pidfile $PIDFILE --make-pidfile --exec $DAEMON --test > /dev/null || return 1 start-stop-daemon --background --start --quiet --pidfile $PIDFILE --make-pidfile --exec $DAEMON || return 2 ;; stop) start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --pidfile $PIDFILE [ "$?" = 2 ] && return 2 # Many daemons don't delete their pidfiles when they exit. rm -f $PIDFILE return "$RETVAL" ;; esac
Then add it to the default runlevel with the command: update-rc.d shutdown-if-low-battery defaults