1The Difference Between kill and pkill
2The kill command is a wrapper to the kill system call, which knows only about process IDs. pkill can determine the process ID based on things like, process name, owner of the process or session id.
3
4Syntax:
5$ kill 1234
6$ pkill -f node
7
1process.exit()
2
3//or
4
5if (condition){process.exit()}
6
7//or
8
9setTimeout((function() {
10 return process.exit();
11}), 5000);
12// kill server after 5000ms
13
14//source :
15//https://stackabuse.com/how-to-exit-in-node-js/