Class: Flydata::Command::Routine

Inherits:
Base
  • Object
show all
Defined in:
lib/flydata/command/routine.rb

Instance Attribute Summary

Attributes inherited from Base

#opts

Instance Method Summary collapse

Methods inherited from Base

#ask_input_table_name, #ask_yes_no, #choose_one, #flydata, #initialize, #newline, #register_crontab, #retrieve_data_entries, #separator

Constructor Details

This class inherits a constructor from Flydata::Command::Base

Instance Method Details

#runObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/flydata/command/routine.rb', line 4

def run
  print "#{Time.now} "
  unless flydata.credentials.authenticated?
    raise "Authentication error. Please login."
  end
  log_paths = retrieve_log_paths
  log_paths and log_paths.size() > 0 and log_paths.each { |path|
    if File.exist?(path) and File.writable?(path)
      puts "Start - #{path}. "
      Flydata::LogMonitor.new(path).setup.rotate
    else
      puts "Skip  - #{path}. System cannot access this path."
    end
  }
end