Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Nene Barry
markdown
Commits
2357a05f
Verified
Commit
2357a05f
authored
Nov 04, 2019
by
Laurent Heirendt
✈
Browse files
more elaborate script
parent
cf39f238
Changes
1
Hide whitespace changes
Inline
Side-by-side
contribute.sh
View file @
2357a05f
#!/bin/bash
# set the variables
dockerImg
=
"f2df533bdacc"
dockerPort
=
"9000"
helpFunction
()
{
echo
""
echo
"Usage:
$0
-
a
parameter
A
-
b
parameter
B
"
echo
-e
"
\t
-
a
D
escription of what is parameterA
"
echo
-e
"
\t
-
b Description of what is parameterB
"
echo
"Usage:
$0
-
d
parameter
Date
-
n
parameter
Name
"
echo
-e
"
\t
-
d
D
ata 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
)
parameter
A
=
"
$OPTARG
"
;;
b
)
parameter
B
=
"
$OPTARG
"
;;
d
)
parameter
Date
=
"
$OPTARG
"
;;
n
)
parameter
Name
=
"
$OPTARG
"
;;
?
)
helpFunction
;;
# Print helpFunction in case parameter is non-existent
esac
done
# Print helpFunction in case parameters are empty
if
[
-z
"
$parameter
A
"
]
||
[
-z
"
$parameter
B
"
]
if
[
-z
"
$parameter
Date
"
]
||
[
-z
"
$parameter
Name
"
]
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
"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment