Skip to content

How to restart node app from iteself? #923

Closed
@ronovar

Description

@ronovar

I need when i call api for /restart to restart application.js i try using this code:

child_process.exec(['killall -9 node && node --expose-gc /root/application.js'], 
                   function (error, stdout, stderr) { }
):

But the problem is that node is killed but application.js is not run and application is not running.

I read that i need to use spawn not child_process.exec but i im unable to make it work...so can you please post me above code of using spawn?

I im using node version: v7.10.1
ubuntu server x64 14.04 LTS

I need to kill node (application.js) and run it again...so short say restart application.js

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions