Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
# Quickie script for killing webrick instances. # (I usually start them daemonized (-d) and later need them nixed.) # by dev@forgreatjustice.net #!/usr/bin/env ruby require 'rubygems' require 'highline/import' processes = `ps aux | grep -e "ruby.*script/server" | grep -v grep`.split("\n") if processes.empty? say "No processes found." exit end choose do |menu| menu.prompt = "Which process?" menu.choices(*processes) do |chosen_process| target_pid = chosen_process.split[1] say ("killing #{target_pid}\n" + `kill -INT #{target_pid}`) end end
This paste will be private.
From the Design Piracy series on my blog: