Project

cronjobs

0.0
No commit activity in last 3 years
No release in over 3 years
DSL to manage cronjobs in rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.1

Runtime

< 4.3.0, >= 4.2.0
 Project Readme

Gem Version Code Climate Build Status Dependency Status

Cronjobs

DSL to manage cronjobs in rails.

Why

I did this gem to:

  • Enforce better practices removing unnecessary options.
  • User plain old school cron syntax.
  • Keep a close integration with rails.

Install

Put this line in your Gemfile:

gem 'cronjobs'

Then bundle:

$ bundle

Configuration

Generate the definitions file:

$ bundle exec rails g cronjobs:install

Set the global settings:

Cronjobs.define do

  env 'PATH=$PATH:/usr/local/bin'
  mailto 'test@mail.com'
  output Rails.root.join('log/cronjobs.log')

end

Usage

Definitions

Add the jobs to the definitions file:

Cronjobs.define do

  every '* 1 * * *' do
    rake 'invoices:generate'
  end

  every '0 5 * * *' do
    runner 'User.clear_guests'
  end

end

Rake Task

In your deploy recipe use the rake task to update the cronjobs:

$ bundle exec rake cronjobs:update

Contributing

Any issue, pull request, comment of any kind is more than welcome!

I will mainly ensure compatibility to PostgreSQL, AWS, Redis, Elasticsearch, FreeBSD and Memcached. 

Credits

This gem is maintained and funded by mmontossi.

License

It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.