#!/bin/bash
# Get the battery percentage for battery 0
battery0_percent=$(cat /sys/class/power_supply/BAT0/capacity)
# Get the battery percentage for battery 1
battery1_percent=$(cat /sys/class/power_supply/BAT1/capacity)
# Threshold level
threshold=10
# Check if either battery is less than 10%
if [ "$battery0_percent" -lt "$threshold" ] || [ "$battery1_percent" -lt "$threshold" ]; then
# Display a Zenity warning
zenity --warning --text "Battery level is below 10% on one or both batteries!"
fi
Este script envia um aviso quando uma das minhas baterias está abaixo de 10%.
Como posso executar este script em segundo plano, para que me avise quando for necessário. Qualquer ideia?