javascript - Run Continous Process from Node.js -
the point of server able pick webcam , stream it, along few other things have working. trying run continuous process (mjpg-streamer) within node.js server. node.js server handling serving html page has select drop down binded javascript function send command server via socket.io. drop down lets me select video0, video1, , none. however, whenever try run server refuses saying after particular block of code unreachable or code gets stuck running infinite process. how can execute without locking server? here code causes problem:
child = exec("video0.sh", function (error, stdout, stderr) { sys.print('stdout: ' + stdout); sys.print('stderr: ' + stderr); if (error !== null) { console.log('exec error: ' + error); }
the bash script video0.sh is:
cd mjpg-streamer/mjpg-streamer ; export ld_library_path=. ; ./mjpg_streamer -o "output_http.so -w ./www -p 8080" -i "input_uvc.so -d /dev/video0";
you can set infinite loop in pure shell directly
#!/usr/bin/bash cd mjpg-streamer/mjpg-streamer ; export ld_library_path=. ; while : ./mjpg_streamer -o "output_http.so -w ./www -p 8080" -i "input_uvc.so -d /dev/video0"; sleep 5 done
Comments
Post a Comment