Commit fedd132

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