lib/scout/command.rb in scout-5.5.5 vs lib/scout/command.rb in scout-5.5.6.pre
- old
+ new
@@ -234,29 +234,31 @@
end
end
rescue
running = true
pid = File.read(pid_file).strip.to_i rescue "unknown"
- if pid.zero?
- running = false
- else
- begin
- Process.kill(0, pid)
- if stat = File.stat(pid_file)
- if mtime = stat.mtime
- if Time.now - mtime > 25 * 60 # assume process is hung after 25m
- log.info "Trying to KILL an old process..." if log
- Process.kill("KILL", pid)
- running = false
+ if pid.is_a?(Fixnum)
+ if pid.zero?
+ running = false
+ else
+ begin
+ Process.kill(0, pid)
+ if stat = File.stat(pid_file)
+ if mtime = stat.mtime
+ if Time.now - mtime > 25 * 60 # assume process is hung after 25m
+ log.info "Trying to KILL an old process..." if log
+ Process.kill("KILL", pid)
+ running = false
+ end
end
end
+ rescue Errno::ESRCH
+ running = false
+ rescue
+ # do nothing, we didn't have permission to check the running process
end
- rescue Errno::ESRCH
- running = false
- rescue
- # do nothing, we didn't have permission to check the running process
- end
- end # pid.zero?
+ end # pid.zero?
+ end # pid.is_a?(Fixnum)
if running
if pid == "unknown"
log.warn "Could not create or read PID file. " +
"You may need to specify the path to the config directory. " +
"See: http://scoutapp.com/help#data_file" if log