NodeJS – Execute a Shell Script / Command

So on my continued quest to build an awesome shoutbox in NodeJS + socket.io, I have discovered how to run shell scripts from NodeJS. This was a request from one of the staff members on my site to be able to restart the server if something messes up. What resulted was a shell script that restarts NodeJS and whatever server you are running.

This is the NodeJS code to do this

You can also choose to output something back to the client if need be.

SHARE THIS POST

  • Facebook
  • Twitter
  • Myspace
  • Google Buzz
  • Reddit
  • Stumnleupon
  • Delicious
  • Digg
  • Technorati
Author: Ross View all posts by