PYROS
762 Bytes
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
#!/usr/bin/env bash
# test if user passed a command as parameter
if test $# -lt 1
then
echo "Missing command, use one of the commands below"
python3 pyros.py --help
exit 1
fi
# test if docker is installed
if [ $(docker -v | echo $?) -eq 0 ];
then
docker=true
else
docker=false
fi
if $docker
then
# test if container is running
if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 2 ];
then
container=true;
else
container=false;
fi
if $container;
then
docker exec -it pyros python3 pyros.py $1
else
# starting container first and then launch pyros.py
cd docker; docker-compose up -d
docker exec -it pyros python3 pyros.py $1
fi
else
python3 pyros.py $1
fi