From 20f1341932232c82ce4aa062b355407f49dceb78 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Sat, 27 Jan 2024 01:12:14 -0800 Subject: Eliminate an error message in a race condition in kill_viewvc.sh If the process info can't be read, just skip it instead of displaying "[: : integer expression expected" --- modules/viewvc/templates/kill_viewvc.sh | 8 ++++---- 1 file 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 -- cgit v1.2.1