Skip to content

Instantly share code, notes, and snippets.

@e-neko
Forked from jobsamuel/readme.md
Last active July 25, 2020 12:47

Revisions

  1. e-neko revised this gist Jul 25, 2020. 2 changed files with 3 additions and 0 deletions.
    1 change: 1 addition & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@
    - Go to `/etc/init/`
    - `$ sudo vim yourapp.conf`
    - Paste **script.conf**
    - `$ sudo init-checkconf -d /etc/init/script.conf`
    - `$ sudo start yourapp`
    - And when you wanna kill the process `$ sudo stop yourapp `

    2 changes: 2 additions & 0 deletions script.conf
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,8 @@ respawn limit 99 5
    script

    export HOME="/root"
    chdir /path/to/
    echo $$ > /var/run/yourapp.pid
    exec /usr//bin/nodejs /path/to/yourapp.js >> /var/log/node.log 2>&1

    end script
  2. @jobsamuel jobsamuel revised this gist Sep 5, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    - `$ sudo vim yourapp.conf`
    - Paste **script.conf**
    - `$ sudo start yourapp`
    - And when you wanna kill the process `$ sudo stop app `
    - And when you wanna kill the process `$ sudo stop yourapp `

    ### Reference

  3. @jobsamuel jobsamuel revised this gist Sep 5, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ### Run NodeJS as a Service on Ubuntu 14.04 LTS

    > With Node you can write very fast JavaScript programs serverside. It's pretty easy to install Node, code your program, and run it. But > how do you make it run nicely in the background like a true server?[kvz.io] (http://kvz.io/blog/2009/12/15/run-nodejs-as-a-service-on-ubuntu-karmic/)
    > With Node you can write very fast JavaScript programs serverside. It's pretty easy to install Node, code your program, and run it. But > how do you make it run nicely in the background like a true server?
    - Go to `/etc/init/`
    - `$ sudo vim yourapp.conf`
  4. @jobsamuel jobsamuel revised this gist Sep 5, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ### Run NodeJS as a Service on Ubuntu 14.04 LTS

    > With Node you can write very fast JavaScript programs serverside. It's pretty easy to install Node, code your program, and run it. But > how do you make it run nicely in the background like a true server?
    > With Node you can write very fast JavaScript programs serverside. It's pretty easy to install Node, code your program, and run it. But > how do you make it run nicely in the background like a true server? [kvz.io] (http://kvz.io/blog/2009/12/15/run-nodejs-as-a-service-on-ubuntu-karmic/)
    - Go to `/etc/init/`
    - `$ sudo vim yourapp.conf`
  5. @jobsamuel jobsamuel revised this gist Sep 5, 2014. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,12 @@
    ### Run NodeJS as a Service on Ubuntu 14.04 LTS

    > With Node you can write very fast JavaScript programs serverside. It's pretty easy to install Node, code your program, and run it. But > how do you make it run nicely in the background like a true server?
    - Go to `/etc/init/`
    - `$ sudo vim yourapp.conf`
    - Paste **script.conf**
    - `$ sudo start yourapp`
    - And when you wanna kill the process `$ sudo stop app `

    ### Reference

  6. @jobsamuel jobsamuel revised this gist Sep 5, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion script.conf
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ respawn limit 99 5
    script

    export HOME="/root"
    exec /usr//bin/nodejs /where/yourapp/is/app.js >> /var/log/node.log 2>&1
    exec /usr//bin/nodejs /path/to/yourapp.js >> /var/log/node.log 2>&1

    end script

  7. @jobsamuel jobsamuel revised this gist Sep 5, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions script.conf
    Original file line number Diff line number Diff line change
    @@ -2,12 +2,12 @@ description "node.js server"
    author "Foo Bar"

    # used to be: start on startup
    # until we found some mounts weren't ready yet while booting:
    # until we found some mounts weren't ready yet while booting

    start on started mountall
    stop on shutdown

    # Automatically Respawn:
    # automatically respawn

    respawn
    respawn limit 99 5
    @@ -21,7 +21,7 @@ end script

    post-start script

    # Optionally put a script here that will notifiy you node has (re)started
    # optionally put a script here that will notifiy you node has (re)started
    # /root/bin/hoptoad.sh "node.js has started!"

    end script
  8. @jobsamuel jobsamuel revised this gist Sep 5, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,11 @@
    # Run NodeJS as a Service on Ubuntu 14.04 LTS
    ### Run NodeJS as a Service on Ubuntu 14.04 LTS

    - Go to `/etc/init/`
    - `$ sudo vim yourapp.conf`
    - Paste **script.conf**
    - `$ sudo start yourapp`

    # Reference
    ### Reference

    Thanks to [kvz.io] (http://kvz.io/blog/2009/12/15/run-nodejs-as-a-service-on-ubuntu-karmic/) for this!

  9. @jobsamuel jobsamuel created this gist Sep 5, 2014.
    11 changes: 11 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # Run NodeJS as a Service on Ubuntu 14.04 LTS

    - Go to `/etc/init/`
    - `$ sudo vim yourapp.conf`
    - Paste **script.conf**
    - `$ sudo start yourapp`

    # Reference

    Thanks to [kvz.io] (http://kvz.io/blog/2009/12/15/run-nodejs-as-a-service-on-ubuntu-karmic/) for this!

    27 changes: 27 additions & 0 deletions script.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    description "node.js server"
    author "Foo Bar"

    # 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

    export HOME="/root"
    exec /usr//bin/nodejs /where/yourapp/is/app.js >> /var/log/node.log 2>&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