Sha256: 0f904328da7bb60c8eca6d8b5c807df8ad5ebdafd07e441345c6806a6655c173

Contents?: true

Size: 747 Bytes

Versions: 4

Compression:

Stored size: 747 Bytes

Contents

require 'mongrel'
require 'gem_plugin'

class Status < GemPlugin::Plugin "/commands"
  include Mongrel::Command::Base

  def configure 
    options [ 
             ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, Dir.pwd],
             ['-P', '--pid FILE', "Where to write the PID", :@pid_file, "log/mongrel.pid"]
    ]
  end
  
  def validate
    @cwd = File.expand_path(@cwd)
    valid_dir? @cwd, "Invalid path to change to during daemon mode: #@cwd"

    @pid_file = File.join(@cwd,@pid_file)
    valid_exists? @pid_file, "PID file #@pid_file does not exist. Not running?" 

    return @valid
  end


  def run
    pid = open(@pid_file) {|f| f.read }
    puts "Mongrel status:"
    puts "PID: #{pid}"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongrel_status-0.1 lib/init.rb
mongrel_status-0.2 lib/mongrel_status/init.rb
mongrel_status-0.2.1 lib/mongrel_status/init.rb
mongrel_status-0.2.2 lib/mongrel_status/init.rb