Guest User

Untitled

a guest
Feb 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. #actually I just wanted to try forking a gist :D
  3.  
  4. exit unless ARGV.size == 1
  5.  
  6. pids = %x[ps ax|grep #{ARGV[0]}|grep -v grep].split("\n").map{|line| line.strip.scan(/^\d+/).first.to_i} - [Process.pid]
  7.  
  8. if pids.any?
  9. system "kill #{pids.join(' ')}"
  10. puts "killed #{pids.size} #{ARGV[0]} instance(s)"
  11. else
  12. puts "no rails processes found"
  13. end
Add Comment
Please, Sign In to add comment