Topic: Using cron-parse and chronic


I'm trying to figure out how to use cron-parse and chronic (and/or chronic_duration) gems with each other in order to parse cron jobs that execute during a set period of time (i.e. between every 1 minute to every 14 minutes every day of the week/month). I have kind of a working script at the moment, but I want it to be a bit more robust and not require any external input (i.e I just want to execute ./script.rb instead of ./script.rb <ARG1> <ARG2>).

Here's the current format of the script:


require 'rubygems'
require 'crontab-parser'
require 'chronic'
require 'chronic_duration'

Dir["/var/spool/cron/*"].each do |file|
  username = file.split("/").last
  crontab =
  crontab.each do |cron|
    puts "User: #{username}"
    # Do whatever

As you can see it's just the beginning, but I'm stuck here as I can't figure out how to use the crontab-parser in conjunction with chronic in order to accomplish what I want. Any help would be appreciated.