Skip to content

uxxman/tomo-plugin-cron

Repository files navigation

tomo-plugin-cron

GitHub Workflow Status Code Climate coverage Code Climate maintainability Gem

This is a tomo plugin that provides tasks for managing cron jobs using ruby DSL provided by the awesome whenever gem.

Installation

Run:

$ gem install tomo-plugin-cron

Or add it to your Gemfile:

gem "tomo-plugin-cron"

Then add the following to .tomo/config.rb:

plugin "cron"

Now, create a file schedule.rb alongside your tomo config file and start writing cron jobs in ruby.

# .tomo/schedule.rb

every 3.hours do
  rake "my:rake:task"
  runner "MyModel.some_process"
  command "/usr/bin/my_great_command"
end

every 1.day, at: '4:30 am' do
  runner "MyModel.task_to_run_at_four_thirty_in_the_morning"
end

For more examples, checkout out whenever gem readme.

Settings

Name Required Purpose Default
cron_schedule_path No Schedule file location .tomo/schedule.rb

Tasks

cron:show

Print out current content of crontab.

cron:install

Translate schedules defined inside your schedule.rb file into cron syntax and write them to your host's crontab.

cron:uninstall

Delete host's crontab.

Support

If you want to report a bug, or have ideas, feedback or questions about the gem, let me know via GitHub issues and I will do my best to provide a helpful answer. Happy hacking!

License

The gem is available as open source under the terms of the MIT License.

Code of conduct

Everyone interacting in this project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Contribution guide

Pull requests are welcome!