Verified Commit 2357a05f authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

more elaborate script

parent cf39f238
#!/bin/bash
# set the variables
dockerImg="f2df533bdacc"
dockerPort="9000"
helpFunction()
{
echo ""
echo "Usage: $0 -a parameterA -b parameterB"
echo -e "\t-a Description of what is parameterA"
echo -e "\t-b Description of what is parameterB"
echo "Usage: $0 -d parameterDate -n parameterName"
echo -e "\t-d Data of presentation"
echo -e "\t-n Name of presentation"
exit 1 # Exit script after printing help
}
while getopts "a:b:" opt
while getopts "d:n:" opt
do
case "$opt" in
a ) parameterA="$OPTARG" ;;
b ) parameterB="$OPTARG" ;;
d ) parameterDate="$OPTARG" ;;
n ) parameterName="$OPTARG" ;;
? ) helpFunction ;; # Print helpFunction in case parameter is non-existent
esac
done
# Print helpFunction in case parameters are empty
if [ -z "$parameterA" ] || [ -z "$parameterB" ]
if [ -z "$parameterDate" ] || [ -z "$parameterName" ]
then
echo "Some or all of the parameters are empty";
helpFunction
fi
# launch the docker file
cmd="python contribute.py --date=\"$parameterA\" --name=\"$parameterB\""
docker run -p 9000:9000 -it -v $(pwd)/:/presentation f2df533bdacc /bin/bash -c "$cmd"
cmd="python contribute.py --date=\"$parameterDate\" --name=\"$parameterName\""
docker run -p $dockerPort:$dockerPort -it -v $(pwd)/:/presentation $dockerImg /bin/bash -c "$cmd"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment