Saturday, December 21, 2024
HomeSoftware DevelopmentTerminate Course of on a Port from Command Line

Terminate Course of on a Port from Command Line

[ad_1]

As soon as per week I’ve to take care of a zombie course of or attempt to begin a course of that is already working on its designated port. Normally I exploit macOS’s Exercise Monitor to kill the method, which is time-consuming. What if we might simply kill a course of on a given port from command line? Properly, we will!

To terminate a course of on a given port, set up kill-port and beginning nuking these zombies by way of:

# yarn world add kill-port

# Kill processes on a number of ports
kill-port 6060 8000

If you wish to programmatically kill a port that you simply need to guarantee your app will run on, you are able to do that as effectively:

const kill = require('kill-port')

kill(6060, 'tcp')
      .then(console.log)
      .catch(console.log)

I sit up for incorporating this library into my Node.js websites in order that I can clear the best way for a given port and keep away from zombie processes.

  • Animated 3D Flipping Menu with CSS
  • Regular Expressions for the Rest of Us

    Eventually you will run throughout an everyday expression. With their cryptic syntax, complicated documentation and big studying curve, most builders accept copying and pasting them from StackOverflow and hoping they work. However what in case you might decode common expressions and harness their energy? In…

  • pointer Media Query

    As extra gadgets emerge and variations in system interplay are applied, the extra essential good CSS code will develop into.  To be able to write good CSS, we’d like some indicator about system capabilities.  We have used CSS media queries to this point, with checks for max-width and pixel ratios.

  • Using TogetherJS

[ad_2]
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments