summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2015-12-10 16:57:31 +0000
committerJoe Robinson <joe@lc8n.com>2015-12-10 16:57:31 +0000
commitb2bfc5a2ddf66d18d96fe8936915435db34b4042 (patch)
tree8502e24eff3a858fe7ae4840cf3d87e70ca92813 /src
parentbe25dacee465e78233e34e92799c05c95e3e9deb (diff)
Force MsgRelayController to use bash
Diffstat (limited to 'src')
-rw-r--r--src/main/java/uk/co/blatech/blaears/controllers/MsgRelayController.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/uk/co/blatech/blaears/controllers/MsgRelayController.java b/src/main/java/uk/co/blatech/blaears/controllers/MsgRelayController.java
index a89b47c..43a5439 100644
--- a/src/main/java/uk/co/blatech/blaears/controllers/MsgRelayController.java
+++ b/src/main/java/uk/co/blatech/blaears/controllers/MsgRelayController.java
@@ -1,6 +1,7 @@
package uk.co.blatech.blaears.controllers;
import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -9,12 +10,16 @@ import java.io.IOException;
@Controller
public class MsgRelayController {
@RequestMapping("/msgrelay")
- void relay(@RequestParam(value="text", required=true) String text){
+ String relay(@RequestParam(value="text", required=true) String text, Model model){
try {
- Runtime.getRuntime().exec("echo theblueroom test | ./msgrelay.bash " + text);
+ Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "echo theblueroom test " + text + " | bash /home/smsd/msgrelay.bash "});
+ model.addAttribute("result", "OK");
} catch (IOException e) {
- System.out.println("Failed to run command echo theblueroom test | ./msgrelay.bash " + text);
+ System.out.println("Failed to run command echo theblueroom test " + text + " | bash /home/smsd/msgrelay.bash ");
e.printStackTrace();
+ model.addAttribute("result", "failed");
}
+
+ return "msgrelay";
}
} \ No newline at end of file