diff --git a/Femto-DS/Femto-DS.sh b/Femto-DS/Femto-DS.sh deleted file mode 100755 index 785f8797025565a359b12d93da01a135f2e88ae6..0000000000000000000000000000000000000000 --- a/Femto-DS/Femto-DS.sh +++ /dev/null @@ -1,16 +0,0 @@ -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} diff --git a/RandomData-DS/RandomData-DS.sh b/RandomData-DS/RandomData-DS.sh deleted file mode 100755 index 785f8797025565a359b12d93da01a135f2e88ae6..0000000000000000000000000000000000000000 --- a/RandomData-DS/RandomData-DS.sh +++ /dev/null @@ -1,16 +0,0 @@ -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} diff --git a/tools/itango/start-DS.sh b/tools/itango/start-DS.sh new file mode 100755 index 0000000000000000000000000000000000000000..eabca56f79b5e667cc029ae043c8452bc83f195e --- /dev/null +++ b/tools/itango/start-DS.sh @@ -0,0 +1,41 @@ +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} ${@}