1 |
#!/bin/sh |
2 |
# Simple shell to control the amount of memory used by swish-e |
3 |
# while indexing |
4 |
# |
5 |
# It assumes that there is only one swish-e proc running |
6 |
# This script is onlu for testing |
7 |
# |
8 |
# max allowed memory in kilobytes for swish-e |
9 |
# |
10 |
maxmemory=50000 |
11 |
|
12 |
while test 1 |
13 |
do |
14 |
swishdata=`ps -o pid -o rss -o comm -ef | grep swish-e` |
15 |
pid=`echo $swishdata | cut -d ' ' -f 1` |
16 |
rss=`echo $swishdata | cut -d ' ' -f 2` |
17 |
echo "swish-e with pid $pid is using $rss Kilobytes" |
18 |
|
19 |
if [ $rss -gt $maxmemory ] |
20 |
then |
21 |
echo "Swish is using more than $maxmemory" |
22 |
kill -9 $pid |
23 |
exit |
24 |
fi |
25 |
#Sleep 1 minute |
26 |
sleep 60 |
27 |
done |