Last active
May 26, 2020 16:43
-
-
Save anibalardid/53b27673315e341e80857e285c14c958 to your computer and use it in GitHub Desktop.
bash ubuntu script low battery alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
battery_level=`acpi -b | grep -P -o '[0-9]+(?=%)'` | |
if [ $battery_level -le 10 ] | |
then | |
notify-send "Battery low" "Battery level is ${battery_level}% !!!" | |
fi | |
# After that, add to crontab | |
# */5 * * * * bash ~/batteryalert.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment