tor_multipath_voip/scripts/xp-instance-runner
Quentin Dufour 8c5ea96ecd Fix scripts
2019-04-18 16:36:14 +02:00

49 lines
1 KiB
Bash
Executable file

#!/bin/bash
# Create workdir
XP_NAME=$1
XP_FOLDER=`mktemp -d -p . ${XP_NAME}-XXXXXXXXXXXXXXXX`
XP_ID=`echo $XP_FOLDER|cut -c 3-`
cd $XP_FOLDER
COUNT=$2
INTERVAL=$3
SIZE=$4
ALLOWED_BOOTSTRAP=190
# Create folders
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 \
-d \
--name "$XP_ID-server" \
-v `pwd`/shared:/home/donar/shared \
-v `pwd`/log:/home/donar/log \
registry.gitlab.inria.fr/qdufour/donar \
${XP_NAME}-server
sleep 10
docker ps
# Run client
docker run \
--privileged \
--rm \
--name "$XP_ID-client" \
$( [[ "${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 \
${XP_NAME}-client $COUNT $INTERVAL $SIZE
# Kill
#docker kill "$XP_ID-client" || true
docker kill "$XP_ID-server" || true