Skip to content

Instantly share code, notes, and snippets.

@langalex
Created November 5, 2008 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save langalex/22340 to your computer and use it in GitHub Desktop.
Save langalex/22340 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
pids = %x[ps ax|grep rails|grep -v grep].split("\n").map{|line| line.strip.scan(/^\d+/).first.to_i} - [Process.pid]
if pids.any?
system "kill #{pids.join(' ')}"
puts "killed #{pids.size} rails instance(s)"
else
puts "no rails processes found"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment