Sha256: b43659b7002f89e7fad80ea1c813507653a837e6631fdf1acf7024b40e44d766

Contents?: true

Size: 582 Bytes

Versions: 3

Compression:

Stored size: 582 Bytes

Contents

module Process

  # return a string obj that include the memory usage info
  def self.memory_usage

    begin
      return `pmap #{self.pid}`.lines.to_a(
      ).last.chomp.scan(/ *\w* *(\w+)/)[0][0]
    rescue NoMethodError
      return nil
    end

  end


  def self.daemonize
    File.create Application.pid,'a+'
    File.create Application.log,'a+'
    File.create Application.daemon_stderr,'a+'
    Daemon.start fork,
                 Application.pid,
                 Application.log,
                 Application.daemon_stderr
  end
  def self.stop
    Daemon.stop
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mpatch-1.3.0 lib/mpatch/process.rb
mpatch-1.2.0 lib/mpatch/process.rb
mpatch-1.1.0 lib/mpatch/process.rb