Skip to content

Instantly share code, notes, and snippets.

@kschiess
Created March 21, 2012 12:59
Show Gist options
  • Select an option

  • Save kschiess/2146730 to your computer and use it in GitHub Desktop.

Select an option

Save kschiess/2146730 to your computer and use it in GitHub Desktop.
Hunts down your unicorn workers and kills them
require 'guard/guard'
module Guard
class UnicornHunter < Guard
# Called on file(s) modifications that the Guard watches.
# @param [Array<String>] paths the changes files or paths
# @raise [:task_has_failed] when run_on_change has failed
def run_on_change(paths)
if system("killall -m 'unicorn worker'")
puts "Unicorn hunter has found a unicorn..."
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment