Sha256: 53ba9f5a2067a2371977c8e2bf02504d3579d0f5520222f009d59ef2256f3c08
Contents?: true
Size: 691 Bytes
Versions: 13
Compression:
Stored size: 691 Bytes
Contents
require 'flydata' require 'flydata/helper/base_action' module Flydata module Helper module Action class CheckAbnormalShutdown < BaseAction def execute(opts = {}) if abnormal_shutdown_occurred? log_info "Abnormal shutdown occurred. Restart the agent." yield :restart_agent, nil end end private def abnormal_shutdown_occurred? File.exists?(FLYDATA_LOCK) && !process_exists?(File.open(FLYDATA_LOCK){|f| f.read}) end def process_exists?(pid) Process.getpgid(pid.to_i) true rescue Errno::ESRCH false end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems