summaryrefslogtreecommitdiff
path: root/src/jobs
diff options
context:
space:
mode:
Diffstat (limited to 'src/jobs')
-rw-r--r--src/jobs/CreateFile.php15
-rw-r--r--src/jobs/Hello.php15
2 files changed, 30 insertions, 0 deletions
diff --git a/src/jobs/CreateFile.php b/src/jobs/CreateFile.php
new file mode 100644
index 0000000..439925f
--- /dev/null
+++ b/src/jobs/CreateFile.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace jobs;
+
+class CreateFile extends \Job
+{
+
+ public function run()
+ {
+ $file = $this->input['file'];
+ if (!touch($file))
+ throw new \Exception("failed to touch file '".$file."'");
+ }
+
+}
diff --git a/src/jobs/Hello.php b/src/jobs/Hello.php
new file mode 100644
index 0000000..4fa2446
--- /dev/null
+++ b/src/jobs/Hello.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace jobs;
+
+class Hello extends \Job
+{
+
+ public function run()
+ {
+ $greetings = "Hello, ".($this->input['name'] ?? 'noname').".\n";
+ $greetings .= "I'm writing you from ".__METHOD__.", my PID is ".getmypid()." and I'm executing job #".$this->id.".";
+ echo jsonEncode(['response' => $greetings]);
+ }
+
+}