Cron Info
A command-line tool that parses a cron string and expands each field to show the times at which it will run.
Installation
There are two ways to install Cron Info, either straight from RubyGems or from the repository.
Installing from RubyGems
gem install cron_info
Installing from repository
Clone the repository:
git clone https://github.com/SebastianCoetzee/cron_info.git
Change into the directory:
cd cron_info
Build the gem:
gem build cron_info.gemspec
Install the gem (replace x
with the version number of the gem):
gem install cron_info-x.x.x.gem
Usage
Run the tool with the following command, which parses a cron string and expands each field to show the times at which it will run:
cron_info "*/15" 0 1,15 "*" 1-5 /usr/bin/find
Output:
minute 0 15 30 45
hour 0
day of month 1 15
month 1 2 3 4 5 6 7 8 9 10 11 12
day of week 1 2 3 4 5
command /usr/bin/find
The command also supports named months and days:
cron_info "*/15,1,1-5,34-50" 0 1,15 Jan-Apr,Nov Mon,Thu-Sat echo hello
Output:
minute 0 1 2 3 4 5 15 30 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
hour 0
day of month 1 15
month 1 2 3 4 11
day of week 1 4 5 6
command echo hello
Testing
After cloning the repository as explained above, from the root of the repository, run the following:
gem install bundler
Then install the dependencies:
bundle install
After the dependencies are installed, run the following command to run the test suite:
rspec
License
MIT