Skip to content

Instantly share code, notes, and snippets.

@ppdeassis
Created January 17, 2014 23:18
Show Gist options
  • Save ppdeassis/8483493 to your computer and use it in GitHub Desktop.
Save ppdeassis/8483493 to your computer and use it in GitHub Desktop.
whenever gem sample schedule.rb file
# IMPORTANT
# When you run `wheneverize .` on your app root path, it'll create a config/schedule.rb file.
# Below is a sample content for schedule.rb
# -------
# this file is in app/config. let's find out app root path
app_path = "#{File.expand_path(File.dirname(__FILE__))}/../"
# log files
stdlog = "#{app_path}/messages"
errlog = "#{app_path}/errors"
# Not using this because whenever does not escape those paths...
#set :output, { :standard => "#{app_path}/messages", :error => "#{app_path}/errors" }
every 15.minutes do
command "cd \"#{app_path}\" && git pull origin master && git push origin master >> #{stdlog} 2>> #{errlog}"
end
# cleaning logs, since they're not that important
every 2.days do
command "echo '' > \"#{stdlog}\""
command "echo '' > \"#{errlog}\""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment