From b792945e3945c291fe7b7dae85bf0f014a746038 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 28 Apr 2006 03:56:30 +0000 Subject: [PATCH] Added script/process/inspector to do simple process status information on Rails dispatchers keeping pid files in tmp/pids [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4300 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/CHANGELOG | 2 ++ railties/Rakefile | 2 +- railties/bin/process/inspector | 3 +++ railties/lib/commands/process/inspector.rb | 7 ++++--- .../generators/applications/app/app_generator.rb | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 railties/bin/process/inspector diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 281e495865..23e295cd72 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added script/process/inspector to do simple process status information on Rails dispatchers keeping pid files in tmp/pids [DHH] + * Added pid file usage to script/process/spawner and script/process/reaper along with a directive in default config/lighttpd.conf file to record the pid. They will all save their pid file in tmp/pids [DHH] diff --git a/railties/Rakefile b/railties/Rakefile index 6f47b08301..ad799cd0f0 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -41,7 +41,7 @@ LOG_FILES = %w( server.log development.log test.log production.log ) HTML_FILES = %w( 404.html 500.html index.html robots.txt favicon.ico images/rails.png javascripts/prototype.js javascripts/application.js javascripts/effects.js javascripts/dragdrop.js javascripts/controls.js ) -BIN_FILES = %w( about breakpointer console destroy generate performance/benchmarker performance/profiler process/reaper process/spawner runner server plugin ) +BIN_FILES = %w( about breakpointer console destroy generate performance/benchmarker performance/profiler process/reaper process/spawner process/inspector runner server plugin ) VENDOR_LIBS = %w( actionpack activerecord actionmailer activesupport actionwebservice railties ) diff --git a/railties/bin/process/inspector b/railties/bin/process/inspector new file mode 100644 index 0000000000..bf25ad86d1 --- /dev/null +++ b/railties/bin/process/inspector @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +require File.dirname(__FILE__) + '/../../config/boot' +require 'commands/process/inspector' diff --git a/railties/lib/commands/process/inspector.rb b/railties/lib/commands/process/inspector.rb index c723f1199a..8b768f8821 100644 --- a/railties/lib/commands/process/inspector.rb +++ b/railties/lib/commands/process/inspector.rb @@ -44,11 +44,12 @@ ARGV.options do |opts| opts.on <<-EOF Description: - Get the lowdown on processes. + Displays system information about Rails dispatchers (or other processes that use pid files) through + the ps command. Examples: - inspector - inspector -s 'ps -o user,start,majflt,pcpu,vsz -p %s' + inspector # default ps on all tmp/pids/dispatch.*.pid files + inspector -s 'ps -o user,start,majflt,pcpu,vsz -p %s' # custom ps, %s is where the pid is interleaved EOF opts.on(" Options:") diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb index 115acb6d01..a61331b5b3 100644 --- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb +++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb @@ -51,7 +51,7 @@ class AppGenerator < Rails::Generator::Base m.file "environments/test.rb", "config/environments/test.rb" # Scripts - %w( about breakpointer console destroy generate performance/benchmarker performance/profiler process/reaper process/spawner runner server plugin ).each do |file| + %w( about breakpointer console destroy generate performance/benchmarker performance/profiler process/reaper process/spawner process/inspector runner server plugin ).each do |file| m.file "bin/#{file}", "script/#{file}", script_options end