Created
March 20, 2014 09:40
-
-
Save hggh/9660326 to your computer and use it in GitHub Desktop.
crontab checker in ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'cron-spec' | |
File.read("/tmp/cron").split("\n").each do |line| | |
next if line =~ /^#/ or line =~ /^$/ | |
data = line.split(" ") | |
cron_time = data[0..4].join(" ") | |
begin | |
cs = CronSpec::CronSpecification.new(cron_time) | |
rescue Exception => e | |
puts e.message | |
puts "Line has problems: #{line}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment