Build on wheezy, and presumably precise
[invirt/third/libt4.git] / start.sh
1 #!/usr/bin/env bash
2
3 ulimit -c unlimited
4
5 NUM_LS=${1:-0}
6
7 BASE_PORT=$RANDOM
8 BASE_PORT=$[BASE_PORT+2000]
9 LOCK_PORT=$[BASE_PORT+6]
10
11 if [ $NUM_LS -gt 1 ]; then
12     x=0
13     rm config
14     while [ $x -lt $NUM_LS ]; do
15       port=$[LOCK_PORT+2*x]
16       x=$[x+1]
17       echo $port >> config
18     done
19     x=0
20     while [ $x -lt $NUM_LS ]; do
21       port=$[LOCK_PORT+2*x]
22       x=$[x+1]
23       echo "starting ./lock_server $LOCK_PORT $port > lock_server$x.log 2>&1 &"
24       ./lock_server $LOCK_PORT $port > lock_server$x.log 2>&1 &
25       sleep 1
26     done
27 else
28     echo "starting ./lock_server $LOCK_PORT > lock_server.log 2>&1 &"
29     ./lock_server $LOCK_PORT > lock_server.log 2>&1 &
30     sleep 1
31 fi