Peter Hickman wrote in post #1030933:
> Well this is a bit of a hack but just to simply parse the lines you
> could use:
>
> a = "10,25,40,55 * * * * /some/cron/here > /dev/null 2>&1\n30 */4 * *
> * /some/cron/here"
>
> a.split(/\n/).each do |line|
>   if line =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)$/
>     output = Array.new
>     output << $6
>     output << "?"
>     output << ($1 == "*" ? 'N' : 'Y')
>     output << ($2 == "*" ? 'N' : 'Y')
>     output << ($3 == "*" ? 'N' : 'Y')
>     output << ($4 == "*" ? 'N' : 'Y')
>     output << ($5 == "*" ? 'N' : 'Y')
>
>     p output
>   end
> end
>
> Which will output:
>
> ["/some/cron/here > /dev/null 2>&1", "?", "Y", "N", "N", "N", "N"]
> ["/some/cron/here", "?", "Y", "Y", "N", "N", "N"]
>
> Note that I left the '?' for the number of servers as that is your
> problem - Think of it as an exercise for the reader :)
>
> Also you might also need to match the Paul Vixie extensions for cron
> such as @hourly and @daily

Thanks for the reply. This looks like a step in the right direction. The 
only problem that I can think of is that the cron jobs aren't always 
going to have the same time, so I don't think having the " a = 
"10,25,40,55 * * * *" portion would work, as it would probably only find 
one entry of that since the times the crons execute are always going to 
vary.

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