Sha256: 28b7d8eefcfc8625bc3ef65f8a3964ac0af10e7405413c1c3f8d2993d3e2cde3

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

Execute.define_task do
  desc "stop", "Stop rhoconnect server"
  def stop
    if windows?
      File.delete "#{rhoconnect_pid}" if system("FOR /F %A in (#{rhoconnect_pid}) do taskkill /F /PID %A")
    else
      if File.exist?("#{rhoconnect_pid}")
        pid = `cat #{rhoconnect_pid}` 
        puts "Sending a QUIT signal to process #{pid}"
        system "kill -3 #{pid}"
        3.times do
          sleep 1
          return if !File.exist?("#{rhoconnect_pid}") 
        end

        puts "Process #{pid} is still running. Sending a KILL signal to it ..."
        system "kill -9 #{pid}"
        File.delete(rhoconnect_pid)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rhoconnect-4.0.0.beta.10 commands/rhoconnect/stop.rb
rhoconnect-4.0.0.beta.12 commands/rhoconnect/stop.rb