Class: ExportMongoS3::Scheduler

Inherits:
Object
  • Object
show all
Defined in:
lib/export_mongo_s3/scheduler.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Scheduler



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/export_mongo_s3/scheduler.rb', line 4

def initialize(options = {})
  @options = options

  if [@options[:write], @options[:clear]].compact.length > 1
    raise 'cron: Can only write or clear. Choose one.'
  end

  unless @options[:time] =~ /\A[*\-,0-9]+ [*\-,0-9]+ [*\-,0-9]+ [*\-,0-9]+ [*\-,0-6]+\z/
    raise 'config.yml: cron_time is not valid'
  end
end

Instance Method Details

#executeObject



16
17
18
# File 'lib/export_mongo_s3/scheduler.rb', line 16

def execute
  write_crontab(updated_crontab)
end