Skip to content
Snippets Groups Projects
Commit 9d5b2024 authored by Thomas Juerges's avatar Thomas Juerges
Browse files

Generalise the DS starting script and add it to the itango tools

parent c8683350
No related branches found
No related tags found
No related merge requests found
runThis=$(basename ${0})
runThis=${runThis//.sh/.py}
if [ -f ${runThis} ]; then
myDir=${PWD}
else
myDir=${PWD}/$(dirname ${0})
fi
if [ ${#} -eq 1 ]; then
instance="${1}"
else
echo "The instance of this device server must be provided!"
exit -1
fi
containerPath=${myDir//${HOME}\//\/hosthome\/}
docker exec -it itango python3 ${containerPath}/${runThis} ${instance}
runThis=$(basename ${0})
runThis=${runThis//.sh/.py}
if [ -f ${runThis} ]; then
myDir=${PWD}
else
myDir=${PWD}/$(dirname ${0})
fi
if [ ${#} -eq 1 ]; then
instance="${1}"
else
echo "The instance of this device server must be provided!"
exit -1
fi
containerPath=${myDir//${HOME}\//\/hosthome\/}
docker exec -it itango python3 ${containerPath}/${runThis} ${instance}
function help()
{
why="${1}"
echo -e "*** Cannot start the Python device server.\n${why}\n\n* The Python file for the device server must be the 1st parameter that is provided.\n* The instance of this device server must be the 2nd parameter that is provided."
exit -1
}
# Check if the mandatory parameters are present:
# ${1}: device server's Python file
# ${2}: instance of the device server's executable in the configDB
case ${#} in
0)
help "The device server's Python file and the instance are missing."
;;
1)
help "The device server's instance is missing."
;;
*)
deviceServer="${1}"
shift
instance="${1}"
shift
;;
esac
# Find the path to the device server's Python file that is
# relative to the /hosthome directory (in Docker the user's
# mounted ${HOME}).
# ATTENTION
# This is assuming that the device server's Python file exists
# on the Docker's host in the user's ${HOME} directory.
runThis=$(basename ${deviceServer})
runThis=${runThis//.sh/.py}
if [ -f ${runThis} ]; then
myDir=${PWD}
else
myDir=${PWD}/$(dirname ${deviceServer})
fi
deviceServerPath=${myDir//${HOME}\//\/hosthome\/}
docker exec -it itango python3 ${deviceServerPath}/${runThis} ${instance} ${@}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment