Rails Cron (rails_cron)

First release 0.1.0 is empty gem.

Gem CI Maintainability Code Coverage License PostgreSQL Redis

A Rails gem to manage cron jobs in a simple and efficient way that is not tied to any specific background job processor.


Install the gem

# Gemfile
gem 'rails_cron'
# Install the gem
bundle install

# Generate the initializer and migrations
bin/rails g rails_cron:install

Features

  • Scheduler-agnostic: Works with any job system (ActiveJob, Sidekiq, Resque, etc.)
  • Multi-node safe: Ensures single-dispatch execution across all app instances
  • Lock adapters: Redis (SET NX PX) and Postgres (pg_try_advisory_lock), plus in-memory fallback
  • Registry & API: Centralized job registration with deterministic idempotency keys
  • Dispatch recovery: Replays missed runs within a configurable lookback window
  • Cron utilities: Validate, lint, simplify (@daily), humanize, and translate via i18n
  • i18n keys: Fully localizable weekdays, months, and time phrases (rails_cron.*)
  • CLI tools: rails-crons explain, next, run, and Rails Rake tasks (rails_cron:start, status, etc.)
  • Standalone mode: Launch scheduler via Procfile, systemd, or Kubernetes
  • Rails integration: Railtie auto-loads configuration and Rake tasks
  • Observability: Optional status inspection via rails_cron:status
  • Graceful shutdown: Handles TERM/INT signals and finishes current tick cleanly
  • Testing: Thread-safe, multi-node safety specs included
  • Development & CI: Bundler, RSpec, RuboCop, GitHub Actions workflows
  • Documentation: README, feature templates, and roadmap included

Professional support

Need help with integrating or customizing rails_cron for your project? We offer professional support and custom development services. Contact us at sales@codevedas.com for inquiries.

License

MIT © Codevedas Inc.