Index: palm/trunk/SCRIPTS/palm_wd
===================================================================
--- palm/trunk/SCRIPTS/palm_wd	(revision 2825)
+++ palm/trunk/SCRIPTS/palm_wd	(revision 3567)
@@ -25,4 +25,8 @@
 # -----------------
 # $Id$
+# Adjustments and bugfixes 
+#
+# 
+# 2825 2018-02-20 21:48:27Z maronga
 # Modified header
 # 
@@ -91,27 +95,24 @@
 
 # Determine PALM directories
-try: 
-   devnull = open(os.devnull, 'w')
-   out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)
-   palm_bin = out.rstrip()
-   palm_dir = out.split("palm")[0] + "palm/" + out.split("palm")[1].split("/")[1]
-   out = None
-except:   
-   print "Error. $PALM_BIN is not set."
-   raise SystemExit
-
-
-# Read configuration file
-# First check if the configuration file exists
-if ( os.path.exists(palm_dir + '/.wd.config') == False ):
-    print "Error. No configuration file .wd.config found in " + palm_dir
-    raise SystemExit     
-
-config = ConfigParser.RawConfigParser()
-config.read(palm_dir + '/.wd.config')
+#  Check if configuration files exists and quit otherwise
+input_config = ".wd.config"
+for i in range(1,len(sys.argv)): 
+   input_config = str(sys.argv[i])
+        
+config = configparser.RawConfigParser(allow_no_value=True)
+
+if ( os.path.isfile(input_config) == False ):
+   print ("Error. No configuration file " + input_config + " found.")
+   raise SystemExit   
+else:
+   print(os.path.isfile(input_config))
+
+config.read(input_config)  
+
 
 description = []
 hostname = []
 username = []
+pycall = []
 
 for i in range(0,len(config.sections())):
@@ -125,4 +126,5 @@
           hostname.append(config.get(description_tmp, 'hostname'))
           username.append(config.get(description_tmp, 'username')) 
+          pycall.append(config.get(description_tmp, 'pycall'))
     else:
        update_frequency = int(config.get(description_tmp, 'update_frequency'))*60000
@@ -401,5 +403,5 @@
 	    # Perform ssh command
             host    = username[h] + "@" + hostname[h]
-            ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd queue " + username[h]],
+            ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd queue " + username[h]],
                            shell=False,
                            stdout=sub.PIPE,
@@ -692,5 +694,5 @@
                   host = username[h] + "@" + hostname[h]
 
-           ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd cancel " + jobname],
+           ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd cancel " + jobname],
                               shell=False,
                               stdout=sub.PIPE,
@@ -719,5 +721,5 @@
                 host = username[h] + "@" + hostname[h]
 
-        ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd check " + jobname],
+        ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd check " + jobname],
                            shell=False,
                            stdout=sub.PIPE,
@@ -746,5 +748,5 @@
                 user = username[h]
 
-        ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd stop " + jobrealname],
+        ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd stop " + jobrealname],
                            shell=False,
                            stdout=sub.PIPE,
@@ -778,5 +780,5 @@
                 user = username[h]
 
-        ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd restart " + jobrealname],
+        ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd restart " + jobrealname],
                            shell=False,
                            stdout=sub.PIPE,
@@ -810,5 +812,5 @@
                 user = username[h]
 
-        ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd parin " + jobrealname],
+        ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd parin " + jobrealname],
                            shell=False,
                            stdout=sub.PIPE,
@@ -843,5 +845,5 @@
                 user = username[h]
 
-        ssh = sub.Popen(["ssh", "%s" % host, "/sw/tools/python/2.7.6/generic/bin/python palm_wdd rc " + jobrealname],
+        ssh = sub.Popen(["ssh", "%s" % host, pycall[h] + " palm_wdd rc " + jobrealname],
                            shell=False,
                            stdout=sub.PIPE,
