Using parse-cron with chronic

Hi there,

I'm trying to wrap my head around ruby and I'm attempting to figure out
how to utilize these two gems in a script, but thus far haven't had much
success. I tend to learn by example, and there's really not much out
there that's helpful in what I'm trying to accomplish here.

Right now, if I just use parse-cron I can execute the script with
something like this: ruby parse-cron.rb "Fri Mar 29 01:00 UTC 2013" "Fri
Mar 29 01:14 UTC 2013" (I'm looking for crons executing between every 1
minute and every 14 minutes while excluding anything executing more
frequently).

However, this is a rather undesirable approach. I'm told I can utilize
chronic to make the parsing of time easier/nicer, but I'm not certain of
how I'd implement it in this scenario. To give you an idea of what I'm
attempting, here's a snippet from my script:

···

---
#!/usr/bin/ruby

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

Dir["/var/spool/cron/*"].each do |file|
  username = file.split("/").last
  crontab = CrontabParser.new(File.read(file))

  crontab.each do |cron|
    puts "User: #{username}"
    # Do whatever
  end
end
---

Any help in this would be appreciated. If I can at least see how/where I
should begin, I should be able to finish the rest on my own.

Thanks.

--
Posted via http://www.ruby-forum.com/.