educatic-info/bin/educatic.rb

39 lines
899 B
Ruby
Raw Normal View History

2022-11-25 15:17:56 +01:00
#!/usr/bin/env ruby
require "yaml"
require "colorize"
class Educatic
attr_reader :settings
def initialize(filename)
@settings = YAML.load(File.read(filename))
@services = settings["services"]
end
def check_services
@services.each_pair do |key, value|
2022-11-25 15:34:00 +01:00
puts "==> #{key} [#{value['hetzner']}]"
2022-11-25 15:17:56 +01:00
cmd = "host #{value['ip']}| grep #{value['hostname']}| wc -l"
counter = %x[#{cmd}].to_i
if counter.zero?
puts " Check this:"
puts " * hostname = #{value['hostname']}"
puts " * ip = #{value['ip']}"
end
unless value['todo'].nil?
puts " TODO:"
value['todo'].each_with_index do |line, index|
puts " #{index + 1}. #{line}"
end
end
end
end
def urls
@services.each_pair do |key, value|
puts "#{key.rjust(16)} : #{value['hostname']}"
end
end
end