aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorDan Fandrich <danf@mageia.org>2024-01-27 01:12:14 -0800
committerDan Fandrich <danf@mageia.org>2024-01-27 01:15:11 -0800
commit20f1341932232c82ce4aa062b355407f49dceb78 (patch)
tree17b0bb574f7078a5f70cb144bc51e3e7880b5d72 /modules
parentb72addd101159ffe4fa403b70c840e649d6cb7b8 (diff)
downloadpuppet-20f1341932232c82ce4aa062b355407f49dceb78.tar
puppet-20f1341932232c82ce4aa062b355407f49dceb78.tar.gz
puppet-20f1341932232c82ce4aa062b355407f49dceb78.tar.bz2
puppet-20f1341932232c82ce4aa062b355407f49dceb78.tar.xz
puppet-20f1341932232c82ce4aa062b355407f49dceb78.zip
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"
Diffstat (limited to 'modules')
-rwxr-xr-xmodules/viewvc/templates/kill_viewvc.sh8
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