From 5395d96b8c8944fef76d7293da3f91b67f27e56b Mon Sep 17 00:00:00 2001 From: VSORC Date: Thu, 24 Oct 2019 16:18:51 -0400 Subject: [PATCH] Start and stop vsorc done (missing check start and stop controller) --- src/routes/index.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/routes/index.js b/src/routes/index.js index 40bcc30..7a36b4f 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -145,10 +145,28 @@ router.get('/startvsorc', (req, res) => { router.get('/stopvsorc', (req,res) =>{ var sys = require('sys') var exec = require('child_process').exec; - var child; - child = exec("cd /home/pi && exec 3>&- && rm fifo aichivo", function(error, stdout, stderr) { + var child1; + var child2; + var child3; + var payload + child1 = exec("cd /home/pi && exec 3>&- && rm fifo aichivo", function(error, stdout, stderr) { console.log(stdout); - res.send(stdout); + console.log("rm done"); + payload+="rm done\n\n"+stdout; + });//esto cierra el fifo, lo cual cierra el programa + + //sudo kill $(ps aux | grep GRE| grep sudo|awk {'print $2'}) && cd /home/pi && ./multissh.sh sudo -E mn -c; sudo -E mn -c + child2 = exec("sudo kill $(ps aux | grep GRE| grep sudo|awk {'print $2'})", function(error, stdout, stderr) { + console.log(stdout); + console.log("killed"); + payload+="killed\n\n"+stdout; + }); + child3 = exec("cd /home/pi && ./multissh.sh sudo -E mn -c; sudo -E mn -c", function(error, stdout, stderr) { + console.log(stdout); + console.log("multisshed"); + payload+="Multisshed\n\n"+stdout; + }); + res.send(payload); }); module.exports = router; -- 2.25.1