namespace :spamotron do desc 'Start the spamotron queue processor' task :start => :environment do Spamotron::Client.new.daemonize! end desc 'Stop the spamotron queue processor' task :stop => :environment do pid_file = File.join(RAILS_ROOT, Spamotron.config[:pid_file]) `kill #{File.open(pid_file).read}` if File.exists?(pid_file) end end