-#!/bin/bash -e
+#!/bin/bash
-a_dir=$(dirname $0)
+source env.sh
+source ${TOOLS_DIR}/env_salome.sh
-cd ${a_dir}
+# kill processes of previous SALOME run
+if [ -f .salomeport ]; then
+ SALOME_PORT=$(cat .salomeport)
+ ${KERNEL_ROOT_DIR}/bin/salome/killSalomeWithPort.py ${SALOME_PORT}
+ pkill -f "omniNames -start ${SALOME_PORT}"
+ rm .salomeport
+fi
-if [ "$#" = 1 ]; then
- export SALOME_PORT="$1"
-elif [ -z ${SALOME_PORT} ]; then
- export SALOME_PORT=2900
-fi
+SALOME_ARGS=""
+SALOME_ARGS="${SALOME_ARGS} -r ./test.squish/shared/testdata/SalomeApp.xml"
+SALOME_ARGS="${SALOME_ARGS} --ns-port-log=$(pwd)/.salomeport"
-echo "Run SALOME on port ${SALOME_PORT}"
+${KERNEL_ROOT_DIR}/bin/salome/runSalome.py ${SALOME_ARGS} >log_runSalome 2>err_runSalome
-source ${a_dir}/env.sh
-source ${a_dir}/env_salome.sh
+SALOME_PORT=$(cat .salomeport)
+echo "Kill SALOME on port ${SALOME_PORT}"
+${KERNEL_ROOT_DIR}/bin/salome/killSalomeWithPort.py ${SALOME_PORT}
+pkill -f "omniNames -start ${SALOME_PORT}"
-set -x +e
-
-${a_dir}/salome_kill.sh
-
-${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --port=${SALOME_PORT} -r ./test.squish/shared/testdata/SalomeApp.xml 2>&1 >/dev/null