aboutsummaryrefslogtreecommitdiffstats
path: root/modules/viewvc/templates/kill_viewvc.sh
blob: 7283a10ce6a41ef8509c2b3004c2cefc6ffe0bac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
# Kill viewvc if the process gets too large
max_memory=1000000  # size in KiB

for process in $(pgrep viewvc.fcgi)
do
    process_mem=$(pmap "$process" | grep total | sed 's/ \+total \+\([[:digit:]]\+\)K/\1/')
    if [ -n "$process_mem" ] && [ "$process_mem" -gt "$max_memory" ]
    then
       kill -15 "$process"
    fi
done