https://github.com/krisleech/harbour
Terminate process listening on a port
https://github.com/krisleech/harbour
Last synced: about 1 year ago
JSON representation
Terminate process listening on a port
- Host: GitHub
- URL: https://github.com/krisleech/harbour
- Owner: krisleech
- License: mit
- Created: 2012-10-06T00:19:30.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-10-27T22:32:33.000Z (over 13 years ago)
- Last Synced: 2025-03-17T04:44:46.135Z (about 1 year ago)
- Language: Ruby
- Size: 121 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Harbour
With harbour you can:
* See if a port is open
* Find the pid of the process listening on a port
* Kill the process listening on a port
Note: Only works on MacOS, GNU/Linux coming soon...
## Installation
Add this line to your application's Gemfile:
gem 'harbour'
## Usage
port = Harbour::Port.new(8080)
port.open? # => true
port.pid # => 1282
port.term!
port.kill!
### Terminating a process
port = Harbour::Port.new(8080)
port.term!(:timeout => 10, :try_kill => true)
* `timeout` - the number of seconds to wait for the process to terminate before
raising an exception
* `try_kill` - if a TERM signal fails before timeout then send a KILL signal
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## Author
Kris Leech / teamcoding.com