Permalink
Browse files

Regret inclusion for now

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1841 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 1ce158a commit 367d2e3cfce3c9e91aa358e05fb0f2c8bb132f6f @dhh dhh committed Jul 16, 2005
Showing with 0 additions and 62 deletions.
  1. +0 −62 railties/lib/program_process.rb
@@ -1,62 +0,0 @@
-class ProgramProcess
- class << self
- def process_keywords(action, *keywords)
- processes = keywords.collect { |keyword| find_by_keyword(keyword) }.flatten
-
- if processes.empty?
- puts "Couldn't find any process matching: #{keywords.join(" or ")}"
- else
- processes.each do |process|
- puts "#{action.humanize}ing #{process}"
- process.send(action)
- end
- end
- end
-
- def find_by_keyword(keyword)
- process_lines_with_keyword(keyword).split("\n").collect { |line|
- next if line.include?("inq") || line.include?("ps -ax") || line.include?("grep")
- pid, *command = line.split
- new(pid, command.join(" "))
- }.compact
- end
-
- private
- def process_lines_with_keyword(keyword)
- `ps -ax -o 'pid command' | grep #{keyword}`
- end
- end
-
- def initialize(pid, command)
- @pid, @command = pid, command
- end
-
- def find
- end
-
- def reload
- `kill -s HUP #{@pid}`
- end
-
- def restart
- kill
- `#{@command}`
- end
-
- def graceful_restart
- graceful_kill
- `#{@command}`
- end
-
- def graceful_kill
- `kill -s TERM #{@pid}`
- end
-
- def kill
- `kill -9 #{@pid}`
- end
-
- def to_s
- "[#{@pid}] #{@command}"
- end
-end

0 comments on commit 367d2e3

Please sign in to comment.