forked from openworm/OpenWorm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·46 lines (41 loc) · 1.03 KB
/
run.sh
File metadata and controls
executable file
·46 lines (41 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
#from: https://unix.stackexchange.com/a/129401
while getopts ":d:p:" opt; do
case $opt in
d) duration="$OPTARG"
;;
p) p_out="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
OW_OUT_DIR=/home/ow/shared
HOST_OUT_DIR=$PWD
xhost +
if [ -z "$duration" ]
then #duration is not set, don't use it
docker run -d \
--name openworm \
--device=/dev/dri:/dev/dri \
-e DISPLAY=$DISPLAY \
-e OW_OUT_DIR=$OW_OUT_DIR \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
--privileged \
-v $HOST_OUT_DIR:$OW_OUT_DIR:rw \
openworm/openworm:0.8 \
bash -c "DISPLAY=:44 python master_openworm.py"
else #Duration is set, use it.
docker run -d \
--name openworm \
--device=/dev/dri:/dev/dri \
-e DISPLAY=$DISPLAY \
-e DURATION=$duration \
-e OW_OUT_DIR=$OW_OUT_DIR \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
--privileged \
-v $HOST_OUT_DIR:$OW_OUT_DIR:rw \
openworm/openworm:0.8 \
bash -c "DISPLAY=:44 python master_openworm.py"
fi
docker logs -f openworm