dyoder (owner)

Revisions

gist: 129372 Download_button fork
public
Public Clone URL: git://gist.github.com/129372.git
Embed All Files: show embed
agents:stop.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  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