--- /dev/null
+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 ]
});
});
+
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;
overflow: hidden;
width: 15em;
}
- input[type="submit"]{
+ button{
border: 0;
border-bottom: 2px black solid;
overflow: hidden;
<body>
<main>
- <form class="" action="/startcontroller" method="get">
- <input type="text" name="" value="" placeholder="Inserte vaina">
- <input type="submit" name="" value="Inicar controlador" >
- </form>
- <form class="" action="/startproyect" method="post">
- <input type="text" name="" value="" placeholder="Ip del controlador">
- <input type="submit" name="" value="Iniciar Proyecto">
- </form>
+ <button type="button" name="button" onclick="startcontroller()">Iniciar controlador</button>
+ <button type="button" name="button" onclick="stopcontroller()">Detener controlador</button>
+ <button type="button" name="button" onclick="startvsorc()">Iniciar VsoRc</button>
+ <script type="text/javascript">
+
+ function stopcontroller() {
+ let xhr = new XMLHttpRequest();
+ xhr.open('GET', '/stopcontroller', true);
+ xhr.onload = function() {
+ if (xhr.status == 200) { //can use this.status instead
+ //console.log(xhr.responseText);// para ver en la consola
+ console.log("controller stoped");
+ }
+ }
+ xhr.send();
+ }
+
+ function startcontroller() {
+ let xhr = new XMLHttpRequest();
+ xhr.open('GET', '/startcontroller', true);
+ //console.log(xhr); //para ver en la consola
+ xhr.onload = function() {
+ if (xhr.status == 200) { //can use this.status instead
+
+ console.log("controller started");
+ }
+ }
+ xhr.send();
+ }
+
+
+ function startvsorc() {
+ let xhr = new XMLHttpRequest();
+ xhr.open('GET', '/startvsorc', true);
+ xhr.onload = function() {
+ if (xhr.status == 200) { //can use this.status instead
+ //console.log(xhr.responseText);// para ver en la consola
+ console.log("vsorc started");
+ }
+ }
+ xhr.send();
+ }
+ </script>
</main>
<aside class="">
<div class="statuscontroller">