From 715c0decbdb8ced5059393b627847bddc6d326ea Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Thu, 8 Dec 2011 08:26:56 +0000
Subject: [PATCH] Task #2744: Moved startPython.sh script from Operations
 repository to LOFAR repository

---
 .../CEPCU/src/PythonControl/startPython.sh    | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100755 MAC/APL/CEPCU/src/PythonControl/startPython.sh

diff --git a/MAC/APL/CEPCU/src/PythonControl/startPython.sh b/MAC/APL/CEPCU/src/PythonControl/startPython.sh
new file mode 100755
index 00000000000..0f3e431a57b
--- /dev/null
+++ b/MAC/APL/CEPCU/src/PythonControl/startPython.sh
@@ -0,0 +1,56 @@
+#!/bin/bash -l
+#
+# This script is started by the MAC Python Controller using the following
+# parameters:
+#
+#   <pythonProgram> <parsetname> <3 fields with communication settings> 
+#
+# For example:
+#
+#   startPython.sh ./pythonProgram /opt/lofar/share/Observation6118 \
+#                  MCU001T MCU001T:PythonControl[0]{6118}:listener  \
+#                  PythonServer{6118}@MCU001T 
+#
+# For the time being, we will ignore the 3 communication settings, because
+# we will not be under control of MAC yet.
+#
+
+# Make sure aliases are expanded, which is not the default for non-interactive
+# shells.
+shopt -s expand_aliases
+
+# Enable debugging messages
+debug=on
+
+usage()
+{
+  echo "Usage: $0 <pythonProgram> <parsetname> <MAC-Python-control-host> \\"
+  echo "         <MAC-Python-control-listener> <MAC-Python-control-server>"
+  exit 1
+}
+
+error()
+{
+  echo "ERROR: $@" 1>&2
+  exit 1
+}
+
+# Check for correct number of input arguments.
+[ $# -eq 5 ] || usage
+
+pythonProgram="$1"
+parsetFile="$2"
+
+# Initialize the environment. We will assume here that we can use the
+# Lofar Login Environment (LLE).
+use LofIm
+
+# Print some debugging information if debugging is enabled.
+if [ -n "$debug" ]; then
+  echo "PATH=${PATH}"
+  echo "PYHONTPATH=${PYTHONPATH}"
+  echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
+fi
+
+# Start the Python program.
+python "${pythonProgram}" "${parsetFile}"
-- 
GitLab