Skip to content
This repository was archived by the owner on Mar 27, 2026. It is now read-only.
This repository was archived by the owner on Mar 27, 2026. It is now read-only.

Cron jobs #2

@peterkeen

Description

@peterkeen

Figure out a good way to set up cron jobs. If that means dropping a file into /etc/cron.d then so be it.

def cron(time, action)
  @crons ||= []
  @crons << {:time => time, :action => action}
end

def write_cron_file
  rows = @crons.map |cron|
    "#{cron[:time]} #{user} #{cron[:action]} | logger -t "
  end

  put("/tmp/cron", rows.join("\n"))
  sudo("mv /tmp/cron /etc/cron.d/#{application}")
end

after :deploy do
  write_cron_file
end

cron "0 0 * * *", "bundle exec rake cron:daily"
cron "0 * * * *", "bundle exec rake cron:hourly"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions