tor_multipath_voip/scripts/xp-instance-runner

53 lines
1.1 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-01 14:11:47 +00:00
${XP_NAME}-server
2019-03-15 08:39:23 +00:00
sleep 10
# Run client
docker run \
--privileged \
--rm \
2019-04-01 14:11:47 +00:00
-d \
2019-03-15 08:39:23 +00:00
--name "$XP_ID-client" \
-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-01 14:11:47 +00:00
${XP_NAME}-client $COUNT $INTERVAL $SIZE
2019-03-15 08:39:23 +00:00
sleep $ALLOWED_TIME
2019-03-06 17:32:19 +00:00
2019-03-15 08:39:23 +00:00
# Kill
docker kill "$XP_ID-client" || true
docker kill "$XP_ID-server" || true