Commit fedd132

xxwhirlpool  ·  2026-05-21 22:09:45 -0400 EDT
parent dff1fcc
check eunoia blogroll URLs
1 files changed,  +27, -0
+27, -0
......@@ -0,0 +1,27 @@
1+#!/usr/bin/env ruby
2+#
3+# ping the URLs in my site's blogroll & see if they're alive
4+# only run this once in a while ig
5+
6+require "yaml"
7+require "net/http"
8+require "uri"
9+
10+yml = YAML.load_file("/home/kat/Projects/mine/eunoia-astro/src/content/blogroll/blogs.yml")
11+
12+yml.each do |y|
13+ uri = URI(y["url"])
14+
15+ begin
16+ res = Net::HTTP.get_response(uri)
17+ case res.code.to_i
18+ when 200
19+ puts "success: #{uri}"
20+ else
21+ res.code
22+ end
23+ rescue SocketError, OpenSSL::SSL::SSLError, Net::ReadTimeout, Net::OpenTimeout => e
24+ puts "error: #{uri} - #{e}"
25+ end
26+end
27+