summaryrefslogtreecommitdiff
path: root/app/models/backup_job.rb
blob: d579b79355894c49a02eb46d9ec0c08f9b577dc7 (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_save :start_the_backup

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