Sha256: 5f0d910faca62209d8dd9b4f4a758d7c16e4a0a1eb8e62b692d28e0ce2b08c7a
Contents?: true
Size: 921 Bytes
Versions: 46
Compression:
Stored size: 921 Bytes
Contents
require 'flydata' require 'flydata/command/base' require 'flydata/helper/base_action' module Flydata module Helper module Action class CheckAbnormalShutdown < BaseAction def execute(opts = {}) if abnormal_shutdown_occurred? if Command::Base.command_process_exist? log_info "Abnormal shutdown occurred but another command is stil running. Skip agent restart." else log_info "Abnormal shutdown occurred. Restart the agent." yield :restart_agent, nil end 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
46 entries across 46 versions & 1 rubygems