diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-02-05 12:41:07 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-02-05 12:41:07 +0100 |
commit | 1c2d8375d32cda0d7819322b165a8270c6500ee9 (patch) | |
tree | 8804da99d69819b2d4253e827230f459c0ebac1c /app/models/backup_job.rb | |
parent | e13f041741fd3a44f407b623da0274d9748c5c54 (diff) | |
parent | bb8168c33f9501fe877345a7bbc7b7f7b64cdfc7 (diff) |
Merge branch 'backup' into develop
Diffstat (limited to 'app/models/backup_job.rb')
-rw-r--r-- | app/models/backup_job.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/backup_job.rb b/app/models/backup_job.rb new file mode 100644 index 0000000..d579b79 --- /dev/null +++ b/app/models/backup_job.rb @@ -0,0 +1,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 |