:output will be replaced with your output redirection settings which you can read more about here: Īll jobs are by default run with bash -l -c 'command.'. :environment will default to 'production'. :environment_variable will default to 'RAILS_ENV'. ![]() If a :path is not set it will default to the directory in which whenever was executed. Pre-Rails 3 apps and apps that don't use Bundler will redefine the rake and runner jobs respectively to function correctly. ![]() Job_type :command, ":task :output" job_type :rake, "cd :path & :environment_variable=:environment bundle exec rake :task -silent :output" job_type :runner, "cd :path & bin/rails runner -e :environment ':task' :output" job_type :script, "cd :path & :environment_variable=:environment bundle exec script/:task :output" Whenever ships with three pre-defined job types: command, runner, and rake. day, at: do runner "Mymodel.task_to_run_in_two_times_every_day" end every :hour do # Many shortcuts available: :hour, :day, :month, :year, :reboot runner "SomeModel.ladeeda" end every :sunday, at: '12pm' do # Use any day of the week or :weekend, :weekday runner "Task.do_something_great" end every '0 0 27-31 * *' do command "echo 'you can use raw cron syntax too'" end # run this task only on servers with the :app role in Capistrano # see Capistrano roles section below every :day, at: '12:20am', roles: do rake "app_server:task" end Define your own job types day, at: '4:30 am' do runner "MyModel.task_to_run_at_four_thirty_in_the_morning" end every 1. hours do # 1.minute 1.day 1.week 1.month 1.year is also supported # the following tasks are run in parallel (not in sequence) runner "MyModel.some_process" rake "my:rake:task" command "/usr/bin/my_great_command" end every 1.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |