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