diff options
-rwxr-xr-x | modules/viewvc/templates/kill_viewvc.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/viewvc/templates/kill_viewvc.sh b/modules/viewvc/templates/kill_viewvc.sh index 8c33c2ff..7283a10c 100755 --- a/modules/viewvc/templates/kill_viewvc.sh +++ b/modules/viewvc/templates/kill_viewvc.sh @@ -1,11 +1,11 @@ #!/bin/sh +# Kill viewvc if the process gets too large +max_memory=1000000 # size in KiB -max_memory=1000000 - -for process in `pgrep viewvc.fcgi` +for process in $(pgrep viewvc.fcgi) do process_mem=$(pmap "$process" | grep total | sed 's/ \+total \+\([[:digit:]]\+\)K/\1/') - if [ "$process_mem" -gt "$max_memory" ] + if [ -n "$process_mem" ] && [ "$process_mem" -gt "$max_memory" ] then kill -15 "$process" fi |