NodeJs runs again to reach Number of Processes limit in cPanel

Viewed 690

I'm using shared hosting cPanel service. I have ran a NodeJs application on server and everything is ok. but after server backup runs in every day one NodeJs process add to the running processes and I can see these processes on terminal.

I have killed the processes but they came back after server backup!!! I have write a code to exit from processes that run when port is busy:

tcpPortUsed.check(port, '127.0.0.1')
.then(function(inUse) {
  console.log(`Port ${port} usage: `+inUse);
  if (inUse) {
    process.exit();
  } else {
    app.listen(port, () =>
      console.log(`server is running on port: ${port}`)
    );
  }
}, function(err) {
  console.error('Error on check:', err.message);
});

but the problem has remained... this is the terminal after I run ps aux:

user   5435  1.0  0.0   9916  1820 pts/0    S    16:50   0:00 /bin/bash -l
user   5752  0.0  0.0  49844  1684 pts/0    R+   16:50   0:00 ps aux
user  13658  0.0  0.1 1155556 36060 ?       Sl   05:15   0:06 lsnode:/home1/user/node-server/
user  32346  0.0  0.1 1091012 37944 ?       Sl   Jul04   0:05 lsnode:/home1/user/node-server/
0 Answers
Related