i3 and battery_nag, reached a point where it successfully kills then restarts on each reload.

This commit is contained in:
me
2026-08-22 12:12:43 -07:00
parent f59a4f90ba
commit c4964a1a1e
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -6,10 +6,9 @@
echo "`date` - Checking Active Programs"
PID="$$"
ps -ef | grep battery_nag.sh | grep -v grep | grep -v killall | grep -v $$
ps -ef | grep battery_nag.sh | grep -v grep | grep -v "sh -c" | grep -v kill | grep -v $$
active=`ps -ef | grep battery_nag.sh | grep -v grep | grep -v killall | grep -vc $$`
active=`ps -ef | grep battery_nag.sh | grep -v grep | grep -v "sh -c" | grep -v kill | grep -vc $$`
if (( "$active" >= 1 )); then
echo "Program already running, exiting. Number of processes: $active"
exit 1
@@ -97,7 +96,9 @@ while true; do
fi
time=$sleep
if [[ "$accelerate" == "Y" ]]; then
if [[ "$accelerate" == "Y" && $batt -lt $alert ]]; then
# Bash only returns whole numbers, so things like 20/11 only provide 1.
# Likewise, if the battery is full, 20/100 returns 0, which is bad. :)
if (( batt > 0 )); then
time=$(( time / (alert / batt) ))
else