メンテナンス画面がちゃらっと欲しくなったとき
備忘ですね
#!/usr/bin/env ruby require 'rubygems' require 'rack' include Rack class MaintenanceRack def call(env) @contents ||= DATA.read [200, {"Content-Type" => "text/html"}, [@contents]] end end port = 18000 case ARGV[0] when '-h','--help' puts 'maintenance.rb [port]' exit when /\d+/ port = ARGV[0].to_i end Handler::WEBrick.run MaintenanceRack.new, :Port => port __END__ <html lang="ja"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body> ただいまメンテナンス中です<br/> system is currently under maintenance </body> </html>