Skip to content

Instantly share code, notes, and snippets.

@dyoder
Created June 13, 2009 18:39
Show Gist options
  • Save dyoder/129372 to your computer and use it in GitHub Desktop.
Save dyoder/129372 to your computer and use it in GitHub Desktop.
desc "Stop agents from running background tasks"
task :stop do
if File.exist?( pidfile )
pid = File.read( pidfile ).to_i
if pid > 0
puts "Stopping agents (process #{pid})."
Process.kill('INT', pid.to_i ) rescue nil
end
`rm #{pidfile}`
else
puts "No agents are currently running."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment