summaryrefslogtreecommitdiffstats
path: root/gearman
diff options
context:
space:
mode:
authorBjörn Geiger2011-07-13 12:44:56 +0200
committerBjörn Geiger2011-07-13 12:44:56 +0200
commit5222f53c5190563a48012ae9127e36e61a8706b3 (patch)
tree2c35ca6385db8d354f6be126a3e7e527aaa8f9dd /gearman
parentminor (diff)
downloadpoolctrl-5222f53c5190563a48012ae9127e36e61a8706b3.tar.gz
poolctrl-5222f53c5190563a48012ae9127e36e61a8706b3.tar.xz
poolctrl-5222f53c5190563a48012ae9127e36e61a8706b3.zip
Gearmantest
Diffstat (limited to 'gearman')
-rw-r--r--gearman/bootWorker.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/gearman/bootWorker.php b/gearman/bootWorker.php
new file mode 100644
index 0000000..9e72960
--- /dev/null
+++ b/gearman/bootWorker.php
@@ -0,0 +1,28 @@
+<?php
+function bootTask(GearmanJob $job) {
+ $context = uniqid('gc_');
+
+ $client= new GearmanClient();
+ $client->addServer();
+
+ $ipArray = job.data.strip();
+
+ if(is_array($ipArray)) {
+ foreach($ipArray as $ip) {
+ $result[] = $client->do("ping", $ip, $context);
+ }
+ }
+
+ if (! $result)
+ {
+ $result = "bad return code\n" . $gmc->error();
+ }
+
+ return $result;
+}
+
+$worker = new GearmanWorker();
+$worker->addServer();
+$worker->register_task("boot", "bootTask");
+$worker->work();
+?> \ No newline at end of file