require 'sys/proctable' include Sys module Commands def Commands.kill(options=nil) ProcTable.ps().find_all{|p| p.comm =~ /p4d/} .each{|p| Process.kill('TERM', p.pid)} end def Commands.print_kill_help puts <<-END.gsub(/^ {6}/,'') p4util kill Finds local p4d processes and kills them. There should be a timeout that will force kill anything that appears stuck. On unix machines, will probably use `ps -x` and 'p4d', then will send SIGTERM signals to each process. END end end