Skip to content

Instantly share code, notes, and snippets.

@tc
Created May 23, 2011 23:46
Show Gist options
  • Save tc/987882 to your computer and use it in GitHub Desktop.
Save tc/987882 to your computer and use it in GitHub Desktop.
helper functions for managing processes
# helper functions for managing processes
def run_system_command(cmd)
puts cmd
status = system(cmd)
$?.exitstatus
end
def kill_matching_process_cmd(process_name)
cmd = "echo `ps -ef | grep -v grep | grep \"#{process_name.gsub("-", "\\-")}\" | awk '{print $2}'` | xargs kill"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment