From 0cb383f1c0646575a831f4f812cd85c9e24d9a18 Mon Sep 17 00:00:00 2001 From: VSORC Date: Thu, 3 Oct 2019 21:45:00 -0400 Subject: [PATCH] fgcfggtf --- 1 | 0 npm-debug.log | 26 +++++++++++++++++++++ src/routes/index.js | 30 +++++++++++++++++++----- src/views/starter.ejs | 53 +++++++++++++++++++++++++++++++++++-------- 4 files changed, 94 insertions(+), 15 deletions(-) create mode 100644 1 create mode 100644 npm-debug.log diff --git a/1 b/1 new file mode 100644 index 0000000..e69de29 diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 0000000..a2cfa34 --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,26 @@ +0 info it worked if it ends with ok +1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ] +2 info using npm@1.4.21 +3 info using node@v8.11.1 +4 verbose run-script [ 'prestart', 'start', 'poststart' ] +5 info prestart web@1.0.0 +6 info start web@1.0.0 +7 verbose unsafe-perm in lifecycle true +8 info web@1.0.0 Failed to exec start script +9 error web@1.0.0 start: `node src/index.js` +9 error Exit status 1 +10 error Failed at the web@1.0.0 start script. +10 error This is most likely a problem with the web package, +10 error not with npm itself. +10 error Tell the author that this fails on your system: +10 error node src/index.js +10 error You can get their info via: +10 error npm owner ls web +10 error There is likely additional logging output above. +11 error System Linux 4.19.57-v7+ +12 error command "/usr/bin/node" "/usr/bin/npm" "start" +13 error cwd /home/pi/VSoRC +14 error node -v v8.11.1 +15 error npm -v 1.4.21 +16 error code ELIFECYCLE +17 verbose exit [ 1, true ] diff --git a/src/routes/index.js b/src/routes/index.js index 7075825..b1f8243 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -71,17 +71,35 @@ router.get('/gettopo', (req, res) => { }); }); + router.get('/startcontroller', (req, res) => { var sys = require('sys') - var exec = require('child_process').spawn; + var exec = require('child_process').exec; var child; - chlid = spawn('python', ['-f','./../pypy.py']); + child = exec("cd /home/pi/ryu && setsid $(cat /home/pi/ryu/ejecutarcontroller.sh | grep sudo) >/dev/null 2>&1 < /dev/null &", function(error, stdout, stderr) { + console.log("controller started"); + res.send(stdout); + }); +}); - pyProg.stdout.on('data', function(data) { +router.get('/stopcontroller', (req, res) => { + var sys = require('sys') + var exec = require('child_process').exec; + var child; + child = exec("sudo kill $(ps aux | grep python | grep ryu | awk {'print $2'})", function(error, stdout, stderr) { + console.log("controller stopped"); + res.send(stdout); + }); +}); - console.log(data.toString()); - res.write(data); - res.end('end'); +router.get('/startvsorc', (req, res) => { + var sys = require('sys') + var exec = require('child_process').exec; + var child; + child = exec("setsid /home/pi/lol.py", function(error, stdout, stderr) { + console.log(stdout); + res.send(stdout); }); }); + module.exports = router; diff --git a/src/views/starter.ejs b/src/views/starter.ejs index 17503f6..b3a588b 100644 --- a/src/views/starter.ejs +++ b/src/views/starter.ejs @@ -28,7 +28,7 @@ overflow: hidden; width: 15em; } - input[type="submit"]{ + button{ border: 0; border-bottom: 2px black solid; overflow: hidden; @@ -43,14 +43,49 @@
-
- - -
-
- - -
+ + + +