diff runXena.py @ 30:77f5d8cbac77

add functionality to check the version of the current running xena server on the galaxy system
author Jing Zhu <jzhu@soe.ucsc.edu>
date Mon, 20 Jul 2015 13:31:33 -0700
parents 14aaed60e07b
children bb84d3bc5308
line wrap: on
line diff
--- a/runXena.py	Mon Jul 13 14:35:34 2015 -0700
+++ b/runXena.py	Mon Jul 20 13:31:33 2015 -0700
@@ -6,7 +6,7 @@
 import logging
 import os
 import signal
-import subprocess
+import subprocess, shlex
 import sys
 import time
 import traceback
@@ -116,6 +116,15 @@
     else:
         fp.write("Xena VM is not currently running on %s\n" % (hostname)) 
 
+elif sys.argv[1] == "version":
+    # check the current xena status
+    if xenaIsRunning:
+        xenaVersionCmd = "java -jar %s --version" % (xena.jarPath())
+        args =shlex.split(xenaVersionCmd)
+        output, error = subprocess.Popen(args, stdout = subprocess.PIPE, stderr= subprocess.PIPE).communicate()
+        fp.write("The current Xena server version is %s\n" % (output))
+    else:
+        fp.write("Xena Server is not currently running on %s, please start the server first, then you can check the server version.\n" % (hostname)) 
 else:
     fp.write(("Error: Unexpected command %s" % sys.argv[1]))