summaryrefslogtreecommitdiffstats
path: root/gearman
diff options
context:
space:
mode:
authorBjörn Geiger2011-08-16 11:59:24 +0200
committerBjörn Geiger2011-08-16 11:59:24 +0200
commit1ee21e0b0685c6e5db35ead7ccf4c6a573b832f6 (patch)
tree1701f5c1d399f43f0a980a00a5ed9a96c77cdcc1 /gearman
parentminor (diff)
downloadpoolctrl-1ee21e0b0685c6e5db35ead7ccf4c6a573b832f6.tar.gz
poolctrl-1ee21e0b0685c6e5db35ead7ccf4c6a573b832f6.tar.xz
poolctrl-1ee21e0b0685c6e5db35ead7ccf4c6a573b832f6.zip
verschiedenes
Diffstat (limited to 'gearman')
-rw-r--r--gearman/controllerWorker/ControllerWorker/Boot.java27
-rw-r--r--gearman/controllerWorker/ControllerWorker/Shutdown.java28
-rwxr-xr-xgearman/worker.sh3
3 files changed, 31 insertions, 27 deletions
diff --git a/gearman/controllerWorker/ControllerWorker/Boot.java b/gearman/controllerWorker/ControllerWorker/Boot.java
index faa75d3..462d888 100644
--- a/gearman/controllerWorker/ControllerWorker/Boot.java
+++ b/gearman/controllerWorker/ControllerWorker/Boot.java
@@ -37,7 +37,7 @@ public class Boot extends Thread {
private HashMap<Integer, GearmanJob> pingWoLJobs;
private HashMap<Integer, GearmanJob> osJobs;
private HashMap<Integer, GearmanJob> whoJobs;
- private HashMap<Integer, GearmanJob> checkStatusJobs;
+ private HashMap<Integer, GearmanJob> topJobs;
private HashMap<Integer, GearmanJob> restartJobs;
private HashMap<Integer, GearmanJob> pingRestartJobs;
private HashMap<Integer, Integer> status;
@@ -58,7 +58,7 @@ public class Boot extends Thread {
this.wolJobs = new HashMap<Integer, GearmanJob>();
this.osJobs = new HashMap<Integer, GearmanJob>();
this.whoJobs = new HashMap<Integer, GearmanJob>();
- this.checkStatusJobs = new HashMap<Integer, GearmanJob>();
+ this.topJobs = new HashMap<Integer, GearmanJob>();
this.restartJobs = new HashMap<Integer, GearmanJob>();
this.pingRestartJobs = new HashMap<Integer, GearmanJob>();
this.status = new HashMap<Integer, Integer>();
@@ -377,12 +377,12 @@ public class Boot extends Thread {
break;
case 11:
- checkStatus(client);
+ top(client);
break;
case 12:
- GearmanJob checkStatusJob = checkStatusJobs.get(clientID);
+ GearmanJob checkStatusJob = topJobs.get(clientID);
if (checkStatusJob != null) {
GearmanJobStatus jobStatus = gearmanClient
@@ -398,15 +398,16 @@ public class Boot extends Thread {
.parse(result);
String rawoutput = resultObj.get("rawoutput")
.toString();
+ System.out.println(rawoutput);
if (rawoutput.equals("is working")) {
System.out.println(ipAddress + " is working");
status.put(clientID, 18); // is working
- checkStatusJobs.remove(clientID);
+ topJobs.remove(clientID);
} else {
System.out.println(ipAddress
+ " is not working");
status.put(clientID, 13); // is not working
- checkStatusJobs.remove(clientID);
+ topJobs.remove(clientID);
}
} else {
System.out.println(ipAddress
@@ -416,7 +417,7 @@ public class Boot extends Thread {
"The check if a user is working has been failed.");
// cannot check if user is working, go in errorState
status.put(clientID, 19);
- checkStatusJobs.remove(clientID);
+ topJobs.remove(clientID);
}
}
}
@@ -635,18 +636,18 @@ public class Boot extends Thread {
System.out.println("who " + ipAddress);
}
- private void checkStatus(HashMap<String, String> client) {
+ private void top(HashMap<String, String> client) {
String ipAddress = client.get("ip");
int clientID = Integer.parseInt(client.get("id"));
- GearmanJob job = GearmanJobImpl.createJob("checkStatus", ipAddress
- .getBytes(), "checkStatus" + clientID);
+ GearmanJob job = GearmanJobImpl.createJob("top", ipAddress.getBytes(),
+ "top" + clientID);
gearmanClient.submit(job);
- status.put(clientID, 12); // checkStatus started
- checkStatusJobs.put(clientID, job);
+ status.put(clientID, 12); // top started
+ topJobs.put(clientID, job);
- System.out.println("checkStatus " + ipAddress);
+ System.out.println("top " + ipAddress);
}
private void restart(HashMap<String, String> client) {
diff --git a/gearman/controllerWorker/ControllerWorker/Shutdown.java b/gearman/controllerWorker/ControllerWorker/Shutdown.java
index 2ed59b6..01c2407 100644
--- a/gearman/controllerWorker/ControllerWorker/Shutdown.java
+++ b/gearman/controllerWorker/ControllerWorker/Shutdown.java
@@ -35,7 +35,7 @@ public class Shutdown extends Thread {
private HashMap<Integer, GearmanJob> whoJobs;
private HashMap<Integer, GearmanJob> shutdownJobs;
private HashMap<Integer, GearmanJob> pingShutdownJobs;
- private HashMap<Integer, GearmanJob> checkStatusJobs;
+ private HashMap<Integer, GearmanJob> topJobs;
private HashMap<Integer, Integer> status;
private HashMap<Integer, String> errors;
private HashMap<Integer, Long> pingShutdownTime;
@@ -51,7 +51,7 @@ public class Shutdown extends Thread {
this.whoJobs = new HashMap<Integer, GearmanJob>();
this.shutdownJobs = new HashMap<Integer, GearmanJob>();
this.pingShutdownJobs = new HashMap<Integer, GearmanJob>();
- this.checkStatusJobs = new HashMap<Integer, GearmanJob>();
+ this.topJobs = new HashMap<Integer, GearmanJob>();
this.status = new HashMap<Integer, Integer>();
this.errors = new HashMap<Integer, String>();
this.updateRate = updateRate; // updates per second
@@ -298,12 +298,12 @@ public class Shutdown extends Thread {
break;
case 9:
- checkStatus(client);
+ top(client);
break;
case 10:
- GearmanJob checkStatusJob = checkStatusJobs.get(clientID);
+ GearmanJob checkStatusJob = topJobs.get(clientID);
if (checkStatusJob != null) {
GearmanJobStatus jobStatus = gearmanClient
@@ -319,15 +319,16 @@ public class Shutdown extends Thread {
.parse(result);
String rawoutput = resultObj.get("rawoutput")
.toString();
+ System.out.println(rawoutput);
if (rawoutput.equals("is working")) {
System.out.println(ipAddress + " is working");
status.put(clientID, 11); // is working
- checkStatusJobs.remove(clientID);
+ topJobs.remove(clientID);
} else {
System.out.println(ipAddress
+ " is not working");
status.put(clientID, 4); // is not working
- checkStatusJobs.remove(clientID);
+ topJobs.remove(clientID);
}
} else {
System.out.println(ipAddress
@@ -337,7 +338,7 @@ public class Shutdown extends Thread {
"The check if a user is working has been failed.");
// cannot check if user is working, go in errorState
status.put(clientID, 12);
- checkStatusJobs.remove(clientID);
+ topJobs.remove(clientID);
}
}
}
@@ -345,6 +346,7 @@ public class Shutdown extends Thread {
break;
case 11:
+ System.out.println("User is working Logik");
break;
@@ -432,18 +434,18 @@ public class Shutdown extends Thread {
System.out.println("ping " + ipAddress);
}
- private void checkStatus(HashMap<String, String> client) {
+ private void top(HashMap<String, String> client) {
String ipAddress = client.get("ip");
int clientID = Integer.parseInt(client.get("id"));
- GearmanJob job = GearmanJobImpl.createJob("checkStatus", ipAddress
- .getBytes(), "checkStatus" + clientID);
+ GearmanJob job = GearmanJobImpl.createJob("top", ipAddress.getBytes(),
+ "top" + clientID);
gearmanClient.submit(job);
- status.put(clientID, 9); // checkStatus started
- checkStatusJobs.put(clientID, job);
+ status.put(clientID, 9); // top started
+ topJobs.put(clientID, job);
- System.out.println("checkStatus " + ipAddress);
+ System.out.println("top " + ipAddress);
}
public String getStatusText(HashMap<String, String> client) {
diff --git a/gearman/worker.sh b/gearman/worker.sh
index b68aca0..dd4d3a8 100755
--- a/gearman/worker.sh
+++ b/gearman/worker.sh
@@ -4,4 +4,5 @@
./whoWorker.py >> whoWorker.log 2>&1 |
./wolWorker.py >> wolWorker.log 2>&1 |
./osWorker.py >> osWorker.log 2>&1 |
-./shutdownWorker.py >> shutdownWorker.log 2>&1
+./shutdownWorker.py >> shutdownWorker.log 2>&1 |
+./topWorker.py >> topWorker.log 2>&1 \ No newline at end of file