I am creating an application in Nodejs using Expressjs framework.
I was try to execute some script after every minute using setInterval() JavaScript method.
When I start my server by node app.js
the script run successfully. But when I stop the server by Ctrl+c
and trying to restart it then it says that the 3000 (my server port) already in use.
I cannot restart my server neither access my website. I am using Ubuntu.
I have used all the following commands but it doesn't stop.
fuser -k 3000/tcp
kill processNumber
killall node
Code:
router.get("/trackplayers", function(req, res, next ) {
// Run in every minute
setInterval(function(){
console.log('Players tracking is under process..');
}, 60000);
});
Thanks in advance!