Crontab RB
crontab_rb is a Ruby gem that provides easy and safe way to manage your cron jobs unix file via CRUD.
Installation
$ gem install crontab_rb
Or with Bundler in your Gemfile.
gem 'crontab_rb'
Run bundle install to install the backend and crontab_rb gems.
Getting started
Add new a cron job at every 10th minute.
# */10 * * * * /bin/bash -l -c 'cd path_to_rails_app && bundle exec rake backup_db'
CrontabRb::Cron.create(name: 'Backup database', time: '1', at: '10', command: 'rake backup_db')
Delete a cron job
CrontabRb::Cron.destroy("64f4f0bc-ad80-48ef-bbb9-98c9c17624bd")
Get list cron jobs
CrontabRb::Cron.all
Update a cron job
# 30 * * * * /bin/bash -l -c 'cd path_to_rails_app && bundle exec rake remove_log'
CrontabRb::Cron.destroy("64f4f0bc-ad80-48ef-bbb9-98c9c17624bd", {name: 'Remove log file', time: '60', at: '30', command: 'rake remove_log'})
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/Nguyenanh/crontab_rb.
Contribute
Fork Crontab RB and contribute to it. Pull requests are encouraged.