Skip to content

Instantly share code, notes, and snippets.

@anibalardid
Last active May 26, 2020 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anibalardid/53b27673315e341e80857e285c14c958 to your computer and use it in GitHub Desktop.
Save anibalardid/53b27673315e341e80857e285c14c958 to your computer and use it in GitHub Desktop.
bash ubuntu script low battery alert
#!/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