tor_multipath_voip/scripts/xp-instance-runner

53 lines
1.2 KiB
Text
Raw Normal View History

#!/bin/bash
# Create workdir
2019-03-28 15:42:02 +00:00
XP_NAME=$1
XP_FOLDER=`mktemp -d -p . ${XP_NAME}-XXXXXXXXXXXXXXXX`
2019-03-15 08:39:23 +00:00
XP_ID=`echo $XP_FOLDER|cut -c 3-`
cd $XP_FOLDER
2019-03-28 15:42:02 +00:00
COUNT=$2
INTERVAL=$3
SIZE=$4
2019-03-15 08:39:23 +00:00
ALLOWED_BOOTSTRAP=190
ALLOWED_TIME=`expr $(expr ${COUNT} * ${INTERVAL}) / 1000 + ${ALLOWED_BOOTSTRAP}`
2019-04-01 14:11:47 +00:00
echo "Will run for ${ALLOWED_TIME} (count=$1, interval=$2)"
# Create folders
2019-03-06 17:32:19 +00:00
docker run \
--rm \
-ti \
-v `pwd`:/mnt \
ubuntu \
bash -c "cd /mnt; mkdir -p ./{shared,log,res}; chown -R 1000 ./{shared,log,res}"
# Run server
docker run \
--privileged \
--rm \
2019-04-01 14:11:47 +00:00
-d \
2019-03-15 08:39:23 +00:00
--name "$XP_ID-server" \
-v `pwd`/shared:/home/donar/shared \
-v `pwd`/log:/home/donar/log \
registry.gitlab.inria.fr/qdufour/donar \
2019-04-02 13:35:17 +00:00
${XP_NAME}-server >/dev/null
2019-03-15 08:39:23 +00:00
sleep 10
# Run client
docker run \
--privileged \
--rm \
2019-03-15 08:39:23 +00:00
--name "$XP_ID-client" \
2019-04-18 12:34:38 +00:00
$( [[ "${XP_NAME}" == 'witness' ]] && echo "--net=container:$XP_ID-server" ) \
-v `pwd`/res:/home/donar/res \
-v `pwd`/shared:/home/donar/shared \
-v `pwd`/log:/home/donar/log \
registry.gitlab.inria.fr/qdufour/donar \
2019-04-02 13:35:17 +00:00
${XP_NAME}-client $COUNT $INTERVAL $SIZE >/dev/null
2019-04-02 13:35:17 +00:00
#sleep $ALLOWED_TIME
2019-03-06 17:32:19 +00:00
2019-03-15 08:39:23 +00:00
# Kill
2019-04-02 13:35:17 +00:00
#docker kill "$XP_ID-client" || true
2019-03-15 08:39:23 +00:00
docker kill "$XP_ID-server" || true