i3 and battery_nag, reached a point where it successfully kills then restarts on each reload.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -380,4 +380,4 @@ exec_always --no-startup-id feh --recursive --randomize --bg-fill ~/Pictures/Wal
|
||||
exec_always --no-startup-id "killall picom; picom -f"
|
||||
|
||||
# Battery
|
||||
exec_always --no-startup-id "pkill -f battery_nag.sh; battery_nag.sh >~/Reports/battery_nag.log 2>&1"
|
||||
exec_always --no-startup-id bash -c 'pkill -ef "bash `which battery_nag.sh`" >~/Reports/battery_nag.log 2>&1; battery_nag.sh >>~/Reports/battery_nag.log 2>&1'
|
||||
|
||||
Reference in New Issue
Block a user