File: port.rb

package info (click to toggle)
ruby-specinfra 2.94.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,464 kB
  • sloc: ruby: 10,562; makefile: 4
file content (14 lines) | stat: -rw-r--r-- 463 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Specinfra::Command::Openbsd::Base::Port < Specinfra::Command::Base::Port
  class << self
    def check_is_listening(port, opts={})
      protocol = opts[:protocol]
      case protocol
      when 'tcp'
        return "netstat -nat -f inet | egrep '(tcp.*.#{port}.*LISTEN$)'"
      when 'udp'
        return "netstat -nat -f inet | egrep '(udp.*.#{port}.*$)'"
      end
      "netstat -nat -f inet | egrep '((tcp|udp).*\.#{port}.*LISTEN$)'"
    end
  end
end