Skip to content

Easy and safe way to manage your crontab file via CRUD

License

Notifications You must be signed in to change notification settings

Nguyenanh/crontab_rb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crontab RB

Gem Version

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.

License

MIT