Run NodeJS as a Service on Ubuntu
<p>i'm try to run nodejs as service as this steps 
1- <code>sudo vim servicelocator.conf</code> 
2- <code>past this .conf</code>  </p>

<pre><code>description "node.js server"
author      "mahmoud elgohary"
# Used to Be: Start on Startup
# until we found some mounts weren't ready yet while booting:
start on started mountall
stop on shutdown

# Automatically Respawn:
respawn
respawn limit 99 5

script
    # Not sure why $HOME is needed, but we found that it is:
    export HOME="/root"

    exec /usr/bin/node /var/lib/nodejsproject/servicelocator/server.js &gt;&gt; /var/log/node.log 2&gt;&amp;1
end script

post-start script
   # Optionally put a script here that will notifiy you node has (re)started
   # /root/bin/hoptoad.sh "node.js has started!"
end script
</code></pre>

<p>3- <code>init-checkconf /etc/init/servicelocator.conf</code> </p>

<p>ERROR: File /etc/init/servicelocator.conf: syntax invalid: init:servicelocator.conf:1: Unknown stanza</p>

<p>4- </p>

<pre><code>ubuntu@ip-172-31-37-243:/etc/init$ sudo start servicelocator
 start: Unknown job: servicelocator
</code></pre>