#! /usr/bin/env ruby $: << File.join(File.dirname(__FILE__), '..', 'lib') require 'setup_environment' require 'optparse' require 'observation_compiler' option_parser = OptionParser.new do |opts| opts.banner = "Usage: download_logs number_of_days\n" + "Downloads logs from all log servers and merge them to one log file per day. Observations are ordered." end ENV['OBSENTER_S3_KEY'] ||= "AKIAI6RLB45ZDVINPZ3Q" if ARGV.size == 1 && ARGV[0] =~ /^\d+$/ start_date = Date.today - ARGV[0].to_i + 1 job = ObservationCompiler::Job.new(:processed_logs_path => File.exist?("/apps/observation_logs") ? "/apps/observation_logs" : "local_files") job.fetch_and_merge(start_date..Date.today) else puts option_parser end