Heroku weekly planner?

How can I run the hero planner weekly?

Is this possible, from what I see, I can only schedule every hour, every 10 minutes, or daily tasks without the weekly option.

If not, what other additions to Heroku can allow me to complete tasks (i.e. cron work) on a weekly chassis in production.

Thank!

Update 2:

  require 'date'
task :weeklydelete do
  if Date.today.wday.zero?
    runner "Event.clear_expired"
    runner "Activity.clear_expired"
  end
end

Update 2.5:

$heroku run bundle exec rake weeklydelete -a friendiosenew
Running `bundle exec rake weeklydelete` attached to terminal... up, run.6194
rake aborted!
undefined local variable or method `path' for main:Object
/app/lib/tasks/weeklydelete.rake:2:in `block in <top (required)>'
Tasks: TOP => weeklydelete
(See full trace by running task with --trace)
+4
source share
4 answers

Set up daily work and check if the day of the week is Sunday (or any other day). If it is that day, run the task. If it's not that day, do nothing and go out.

edit:

require 'date'
task :weeklydelete do
  if Date.today.wday.zero?
    runner "Event.clear_expired"
    runner "Activity.clear_expired"
  end
end

heroku, , , , 3, .

+6

Date . , Date.today.wday.zero? Date.today.sunday?

+4

. bash script Heroku, :

if [ "$(date +%u)" = 1 ]; then MY_COMMAND; fi   # only run on Mondays
+3

, , , , , . , , Sidekiq DelayedJob ( , ), , , , .

, , , / , .

0

Source: https://habr.com/ru/post/1531072/


All Articles