lib/keystone/batch/base.rb in kanamei-kanamei-keystone-0.0.12 vs lib/keystone/batch/base.rb in kanamei-kanamei-keystone-0.0.13

- old
+ new

@@ -38,18 +38,23 @@ # execute() do # info "batch process01" # end # def execute(double_process_check = true,auto_recover = true,&process) - info "start script(#{File.expand_path($0)})" + debug "caller=#{caller}" + pg_path = if File.expand_path(caller[0]) =~ /(.*):\d*\z/ + $1 + end + + info "start script(#{pg_path})" warn "ERROR_MAIL_TO not defined.if you want error mail automatically,set this value." unless Module.constants.include?("ERROR_MAIL_TO") script_started_at = Time.now double_process_check_worked = false begin # double process check if double_process_check - pg_path = File.expand_path($0) + #pg_path = File.expand_path($0) pg_name = File.basename(pg_path) hash = Digest::MD5.hexdigest(pg_path) pid_file = "/tmp/.#{pg_name}.#{hash}.pid" debug pid_file if File.exists?(pid_file) @@ -93,10 +98,10 @@ # エクセプションクラスインスタンス # def send_error_mail(exception) if Module.constants.include?("ERROR_MAIL_TO") host = Keystone::Os.get() - title = %|error occur at "#{host.hostname}" [#{error.message}]| + title = %|error occur at "#{host.hostname}" [#{exception.message}]| mail_to = ERROR_MAIL_TO mail_to = [mail_to] if mail_to.is_a?(String) mail_from = Module.constants.include?("ERROR_MAIL_FROM") ? ERROR_MAIL_FROM : mail_to[0] smtp_addr = Module.constants.include?("ERROR_MAIL_STMP_ADDR") ? ERROR_MAIL_STMP_ADDR : '127.0.0.1'