Skip to main content

Posts

Showing posts from February, 2012

A simple laptop battery monitor script

The script displays alert when the battery falls below 20% or charges up beyond 80% which should be the optimal range of its working.The code is as below. Just copy and paste and save as any file name but preferably battery-notify.sh. The script can independent of what name it is given. Needs to have acpi (default install) and notify-send installed (sudo apt-get install notify-osd).

============================================
#!/bin/bash

# battery-notify v2.5.1 by JOnes

# It is a script to monitor battery and keep it between 20% to 80% the optimal battery working range. If the battery goe beyonds the set limit it gives pop-ups every 10 seconds. No sound warning as sound can easily be muted and ignored. # Things that could be added : 1> The flexibilty of range. But it is not recommended hence not implemented. 2> Notification in form of email or sms. 3> Sound / beep for critical state of battery. # The script goes into background. To kill it at any time use : battery-notify.sh kill