aboutsummaryrefslogtreecommitdiffstats
path: root/modules/viewvc
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2011-08-09 09:07:38 +0000
committerNicolas Vigier <boklm@mageia.org>2011-08-09 09:07:38 +0000
commitbb47ba94c3805634385dccd4f18dc004a9abcb99 (patch)
treea787bc427ee01be84f9cde360ae7f9a11c3d250c /modules/viewvc
parent3d25727178fd3722afa175f3bba927dea7d8de3f (diff)
downloadpuppet-bb47ba94c3805634385dccd4f18dc004a9abcb99.tar
puppet-bb47ba94c3805634385dccd4f18dc004a9abcb99.tar.gz
puppet-bb47ba94c3805634385dccd4f18dc004a9abcb99.tar.bz2
puppet-bb47ba94c3805634385dccd4f18dc004a9abcb99.tar.xz
puppet-bb47ba94c3805634385dccd4f18dc004a9abcb99.zip
add script to kill viewvc.fcgi processes using more than 1G of memory
Diffstat (limited to 'modules/viewvc')
-rwxr-xr-xmodules/viewvc/templates/kill_viewvc.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/viewvc/templates/kill_viewvc.sh b/modules/viewvc/templates/kill_viewvc.sh
new file mode 100755
index 00000000..4c27d3f3
--- /dev/null
+++ b/modules/viewvc/templates/kill_viewvc.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+max_memory=1000000
+
+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" ]
+ then
+ kill -15 "$process"
+ fi
+done
+