Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

how to terminate node process #1172

Closed
Closed
@applemate

Description

I run node server.js in the terminal, then terminal hung, I had to quit terminal.

When I opened the terminal back. I tried to load server.js again, it says add already in use. And the app is still running.

Now I had made some change with server.js, I want to stop the current server, and reload it so the new changes will apply.

How can I terminate the current server.js ?

Activity

murvinlai

murvinlai commented on Jun 20, 2011

@murvinlai

you have to check Linux process.
% ps -A

then, let say the node process id is 12345
then just do that:

% kill 12345 or kill -9 12345

The reason u can't start the server again because it is using the same port.

bradwright

bradwright commented on Jun 20, 2011

@bradwright

An easier way to find this:

ps -ef | grep node

should show you all processes matching node. To kill without knowing the PID (will also kill any other processes matching node):

pkill -f node
dresende

dresende commented on Jun 20, 2011

@dresende

You could listen for SIGUSR1 or SIGUSR2 signals and terminate the process correctly.

process.on("SIGUSR1", function () {
    // stop stuff
    server.end();
    // ...
    // end process
    process.exit(0);
});

You can send the signal with:

kill -USR1 process_id
bnoordhuis

bnoordhuis commented on Jul 5, 2011

@bnoordhuis
Member

Not a bug but seems to have been resolved anyway. :)

nakamuraagatha

nakamuraagatha commented on Jul 13, 2016

@nakamuraagatha

How to start again node after pkill node?

i use this command on ssh

pkill node

and i don't know about start again that node

eljefedelrodeodeljefe

eljefedelrodeodeljefe commented on Jan 24, 2017

@eljefedelrodeodeljefe

@fatimazbouj this is a PHP questions. Please refer to the PHP docs. Probably something like http://php.net/manual/de/function.proc-get-status.php

bnoordhuis

bnoordhuis commented on Jan 24, 2017

@bnoordhuis
Member

This bug tracker is not the right place for support questions, try https://github.com/nodejs/help/issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      how to terminate node process · Issue #1172 · nodejs/node-v0.x-archive