summaryrefslogtreecommitdiff
path: root/app/models/backup_job.rb
blob: b0a588f7f1ef1ac919063c214895b45359e0e8aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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.status = 'done'
      self.save
    end
  end
end