From d17aaf52b18336505e9b4f84c611d61e111dd72c Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Tue, 16 Aug 2011 16:24:07 +0200 Subject: minor --- gearman/controllerWorker/ControllerWorker/Boot.java | 17 +++++++++-------- gearman/psWorker.py | 6 +++--- gearman/worker.sh | 5 +++-- 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'gearman') diff --git a/gearman/controllerWorker/ControllerWorker/Boot.java b/gearman/controllerWorker/ControllerWorker/Boot.java index 7f40059..6e6ab50 100644 --- a/gearman/controllerWorker/ControllerWorker/Boot.java +++ b/gearman/controllerWorker/ControllerWorker/Boot.java @@ -437,19 +437,20 @@ public class Boot extends Thread { JSONObject resultObj = (JSONObject) JSONValue .parse(result); if (!resultObj.containsKey("err")) { - String rawoutput = resultObj.get("rawoutput") - .toString(); - System.out.println(rawoutput); - if (rawoutput.equals("is working")) { + String ps = resultObj.get("ps").toString(); + System.out.println(ps); + if (ps.equals("is working")) { System.out.println(ipAddress + " is working"); status.put(clientID, 18); // is working psJobs.remove(clientID); } else { - System.out.println(ipAddress - + " is not working"); - status.put(clientID, 13); // is not working - psJobs.remove(clientID); + /* + * System.out.println(ipAddress + + * " is not working"); status.put(clientID, + * 13); // is not working + * psJobs.remove(clientID); + */ } } else { System.out.println(ipAddress diff --git a/gearman/psWorker.py b/gearman/psWorker.py index db90a66..cc7cdc0 100755 --- a/gearman/psWorker.py +++ b/gearman/psWorker.py @@ -32,12 +32,11 @@ def psWorker(worker, job): stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - + while sshCommand.returncode == None: out = sshCommand.stdout.readline() if out != "": ret['rawoutput'] += out - time.sleep(0.05) sshCommand.poll() while True: @@ -49,11 +48,12 @@ def psWorker(worker, job): ret['rawoutput'] = ret['rawoutput'].strip() # get rid of newlines rc = ret['rc'] = sshCommand.returncode - if rc == 0: lines = ret['rawoutput'].splitlines() ret['ps'] = [] for l in xrange(len(lines)): + if l == 0: + continue rowentries = lines[l].split() if len(rowentries) == 14: (f, s, uid, pid, ppid, c, pri, ni, addr, sz, wchan, tty, time, cmd) = rowentries diff --git a/gearman/worker.sh b/gearman/worker.sh index 4b97f74..827618a 100755 --- a/gearman/worker.sh +++ b/gearman/worker.sh @@ -4,5 +4,6 @@ ./whoWorker.py >> whoWorker.log 2>&1 | ./wolWorker.py >> wolWorker.log 2>&1 | ./osWorker.py >> osWorker.log 2>&1 | -./shutdownWorker.py >> shutdownWorker.log 2>&1 | -./psWorker.py >> psWorker.log 2>&1 \ No newline at end of file +./psWorker.py >> psWorker.log 2>&1 | +./shutdownWorker.py >> shutdownWorker.log 2>&1 + -- cgit v1.2.3-55-g7522