summaryrefslogtreecommitdiffstats
path: root/admin/Sources
diff options
context:
space:
mode:
authorRamón M. Gómez <ramongomez@us.es>2020-02-19 13:49:46 +0100
committerRamón M. Gómez <ramongomez@us.es>2020-02-19 13:49:46 +0100
commit814a7ba44b3c5d6877b3e8219b173b667d3f504d (patch)
tree3813b73daf0258ee54d4762c27f010a6a8e435f8 /admin/Sources
parented1886b4a943a7bd6b97bc5a4f6acbf2d5ded517 (diff)
#940: OGAgent control scripts looks for Python 2.
Diffstat (limited to 'admin/Sources')
-rwxr-xr-xadmin/Sources/Clients/ogagent/linux/scripts/ogagent10
1 files changed, 9 insertions, 1 deletions
diff --git a/admin/Sources/Clients/ogagent/linux/scripts/ogagent b/admin/Sources/Clients/ogagent/linux/scripts/ogagent
index 1bcc29b0..155af678 100755
--- a/admin/Sources/Clients/ogagent/linux/scripts/ogagent
+++ b/admin/Sources/Clients/ogagent/linux/scripts/ogagent
@@ -1,6 +1,14 @@
#!/bin/sh
+for p in python python2; do
+ [ -z "$PYTHON" ] && [ $($p -c 'import sys; print(sys.version_info[0])') -eq 2 ] && PYTHON=$p
+done
+if [ -z "$PYTHON" ]; then
+ echo "ERROR: OGAgent needs Python 2" &>2
+ exit 1
+fi
+
FOLDER=/usr/share/OGAgent
cd $FOLDER
-python -m opengnsys.linux.OGAgentService $@
+$PYTHON -m opengnsys.linux.OGAgentService $@