title: How to start a Node.js app on system boot?
body: <p>I'm working on a Raspberry Pi running Raspbian running a Node.js app and trying to get it to start when the Pi boots.  I found a couple of examples but I can't seem to get it working.  My current code is:</p>
  
  <pre><code>#! /bin/sh
  # /etc/init.d/MyApp
  
  ### BEGIN INIT INFO
  # Provides:          MyApp.js
  # Required-Start:    $remote_fs $syslog
  # Required-Stop:     $remote_fs $syslog
  # Default-Start:     2 3 4 5
  # Default-Stop:      0 1 6
  # Short-Description: Starts MyApp.js
  # Description:       Start / stop MyApp.js at boot / shutdown.
  ### END INIT INFO
  
  # If you want a command to always run, put it here
  
  # Carry out specific functions when asked to by the system
  case "$1" in
     start)
      echo "Starting MyApp.js"
      # run application you want to start
      node /home/pi/app/MyApp/MyApp.js
     ;;
     stop)
      echo "Stopping MyApp.js"
      # kill application you want to stop
      killall MyApp.js
      ;;
    *)
      echo "Usage: /etc/init.d/MyApp {start|stop}"
      exit 1
      ;;
  esac
  
  exit 0
  </code></pre>
  
  <p>I have this in the etc/init.d folder, ran <code>chmod +x /etc/init.d/MyApp</code>, I'm able to run it manually, then I run <code>sudo update-rc.d MyApp defaults</code>, reboot and the script never runs.  I've looked at some different examples, made adjustments and still no luck.  </p>