Help us understand the problem. What is going on with this article?

h2oでタイマーでリダイレクト(メンテナンスページ表示)

More than 1 year has passed since last update.

タイマー指定でメンテナンスページ化したかった。Apacheのように。
Apacheのようなhtaccessはないが、service h2o reloadが許されるなら下記対応でOK

#h2o.cfg
     paths:
       "/":
         mruby.handler-file: /path/to/maintenance.rb
#maintenance.rb
class Maintenance
  # config                                                                                                                                                                                                          
  # format = %Y/%m/%d %H:%M:%S"                                                                                                                                                                                     
  START_DATETIME = "2019/02/13 00:00:00"
  END_DATETIME = "2019/02/13 18:47:00"
  MAINTENANCE_PATH = "/maintenance.html"

  def call(env)
    return [399, {}, [ ] ] if env["PATH_INFO"] == MAINTENANCE_PATH
    n = Time.new
    now = n.year.to_s + "/" + format('%02d', n.month) + "/" + format('%02d', n.day.to_s) + " " + format('%02d', n.hour.to_s) + ":" + format('%02d', n.min.to_s) + ":" + format('%02d', n.sec.to_s)
    if now >= START_DATETIME and now < END_DATETIME
      return [301, { 'Location' => MAINTENANCE_PATH }, [] ]
    else
      return [399, {}, [ ] ]
    end
  end
end

Maintenance.new

以上です。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away