Demonstration release of the principles underpinning krsd.
[krsd] / scripts / limitcheck.sh
1 #!/bin/bash
2
3 ## DOESN'T WORK!!!
4
5 ## this script attempts to limit memory of rs-serve and see how it behaves.
6 ## it doesn't work for me though. Setting $LIMIT < 5000 causes the shell process
7 ## to run out of memory, but any higher number doesn't cause rs-serve to run out
8 ## of memory.
9 ## In either case, this probably only works anyway if /proc/sys/vm/overcommit_memory
10 ## is adjusted, so requires root privileges.
11
12 LIMIT=$1
13 echo "Running with ulimit -v $LIMIT"
14 SERVER_PID=`bash <<EOF
15   ulimit -v $LIMIT
16   ./rs-serve --port 8181 >limitcheck-server.log 2>&1 &
17   jobs -p
18 EOF`
19
20 if [ "$SERVER_PID" == "" ] ; then
21     echo "Server not started!"
22     exit 1
23 fi
24
25 echo "Server started as $SERVER_PID"
26 sleep 1
27
28 . scripts/run-requests.sh
29
30 kill $SERVER_PID