雑なメモ書き

気楽にいきます

雑な感じでappengineのcron.yamlをグラフィカルに表示したい

require 'yaml'

YAML.load_file('./cron.yaml')['cron'].each_with_index do |row,i|
    if m = row['schedule'].match(/^every\s+day\s+(.+)$/) then
        min_hour = m[1].split(/:/)
        puts "#{min_hour[1]} #{min_hour[0]} * * * #{i}:#{row['description']}"
    elsif m = row['schedule'].match(/^every\s+(\d+)\s+hours\s+(.+)$/) then
        puts "0 */#{m[1]} * * * #{i}:#{row['description']}"
    end
end
  • こんな感じにcron.yamlを適当にparseする
  • なんかいいparseクンはないものだろうか
  • そしてcronvで出力する
ruby convert-crontab.rb | ./cronv -o ./my_cron_schedule.html -d 24h

追記