summaryrefslogtreecommitdiff
path: root/app/models/backup_job.rb
blob: 514955373313b340e2a29e011571c3349d470fdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class BackupJob < ActiveRecord::Base
  attr_accessible :started_at, :finished_at, :state, :directory, :size_of_the_backup

  after_create :start_the_backup

  private
  def start_the_backup
  	if self.finished_at.nil?
      system "backup perform --trigger gs5 --config_file #{Rails.root.join('config','backup.rb')}"
      self.finished_at = Time.now
      self.save
    end
  end
end