summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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