Browse Source

Fix for detecting zero processes and better verbose output for that case.

main
Daniel Perelman 5 months ago
parent
commit
cb53b38a33
1 changed files with 26 additions and 3 deletions
  1. +26
    -3
      cpulimit-all.sh

+ 26
- 3
cpulimit-all.sh View File

@@ -338,14 +338,37 @@ do
exit
fi
limit_by_executable
num_watched_before="$(echo "$watched_pids" | wc -l)"
if [ -z "$watched_pids" ]
then
num_watched_before=0
else
num_watched_before="$(echo "$watched_pids" | wc -l)"
fi
limit_by_subprocess
num_watched_after="$(echo "$watched_pids" | wc -l)"
if [ -z "$watched_pids" ]
then
num_watched_after=0
else
num_watched_after="$(echo "$watched_pids" | wc -l)"
fi
if [ "$num_watched_before" -eq "$num_watched_after" ]
then
if [ "$watch_interval" = "0" ]
then
wait
if [ "$num_watched_after" -eq 0 ]
then
if [ -n "$verbose" ]
then
echo "No processes found, exiting. Specify --watch-interval to continue scanning for processes."
fi
exit
else
if [ -n "$verbose" ]
then
echo "Identified all processes to limit, waiting."
fi
wait
fi
else
sleep "$watch_interval"
fi


Loading…
Cancel
Save