summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile3
-rw-r--r--Gemfile.lock5
-rw-r--r--config/schedule.rb24
-rw-r--r--lib/tasks/backup.rake6
4 files changed, 38 insertions, 0 deletions
diff --git a/Gemfile b/Gemfile
index 58523e1..f273864 100644
--- a/Gemfile
+++ b/Gemfile
@@ -82,6 +82,9 @@ gem 'thin'
# Backup https://github.com/meskyanichi/backup
gem 'backup'
+# Cronjobs
+gem 'whenever'
+
# Local Variables:
# mode: ruby
# End:
diff --git a/Gemfile.lock b/Gemfile.lock
index 64b9f6f..6d348e0 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -47,6 +47,7 @@ GEM
carrierwave (0.8.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
+ chronic (0.9.0)
chunky_png (1.2.7)
coderay (1.0.8)
coffee-rails (3.2.2)
@@ -197,6 +198,9 @@ GEM
raindrops (~> 0.7)
uuid (2.3.6)
macaddr (~> 1.0)
+ whenever (0.8.2)
+ activesupport (>= 2.3.4)
+ chronic (>= 0.6.3)
will_paginate (3.0.4)
yajl-ruby (1.1.0)
@@ -242,4 +246,5 @@ DEPENDENCIES
uglifier (>= 1.3.0)
unicorn
uuid
+ whenever
will_paginate
diff --git a/config/schedule.rb b/config/schedule.rb
new file mode 100644
index 0000000..0b5f0ca
--- /dev/null
+++ b/config/schedule.rb
@@ -0,0 +1,24 @@
+# Use this file to easily define all of your cron jobs.
+#
+# It's helpful, but not entirely necessary to understand cron before proceeding.
+# http://en.wikipedia.org/wiki/Cron
+
+# Example:
+#
+# set :output, "/path/to/my/cron_log.log"
+#
+# every 2.hours do
+# command "/usr/bin/some_great_command"
+# runner "MyModel.some_method"
+# rake "some:great:rake:task"
+# end
+#
+# every 4.days do
+# runner "AnotherModel.prune_old_records"
+# end
+
+every 1.day, :at => '4:00 am' do
+ rake "backup:daily_backup"
+end
+
+# Learn more: http://github.com/javan/whenever
diff --git a/lib/tasks/backup.rake b/lib/tasks/backup.rake
new file mode 100644
index 0000000..c285e1f
--- /dev/null
+++ b/lib/tasks/backup.rake
@@ -0,0 +1,6 @@
+namespace :backup do
+ desc "Backup the system"
+ task :daily_backup => :environment do
+ # This would be the daily backup.
+ end
+end \ No newline at end of file