Guest User

Untitled

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