##F5使系统在X个时间内不提供服务,只显示维护页面
when HTTP_REQUEST {
set curtime [clock seconds]
set formattime [clock format $curtime -format {%H}]
#abc专用POOL
if { [HTTP::uri] starts_with "/abc" } {
pool pool_abc #abc网站正常提供服务
}
else {
#早8点至晚20点提供服务,其余时间显示维护页面
if {$formattime >= 8 && $formattime < 20} {
pool yw_pool
}
else {
pool wh_pool
}
}
}
时间的格式化参数如下:
%% Insert a %.
%a Abbreviated weekday name (Mon, Tue, etc.).
%A Full weekday name (Monday, Tuesday, etc.).
%b Abbreviated month name (Jan, Feb, etc.).
%B Full month name.
%c Locale specific date and time.
%d Day of month (01 - 31).
%H Hour in 24-hour format (00 - 23).
%I Hour in 12-hour format (00 - 12).
%j Day of year (001 - 366).
%m Month number (01 - 12).
%M Minute (00 - 59).
%p AM/PM indicator.
%S Seconds (00 - 59).
%U Week of year (01 - 52), Sunday is the first day of the week.
%w Weekday number (Sunday = 0).
%W Week of year (01 - 52), Monday is the first day of the week.
%x Locale specific date format.
%X Locale specific time format.
%y Year without century (00 - 99).
%Y Year with century (e.g. 1990)
%D Date as %m/%d/%y.
%e Day of month (1 - 31), no leading zeros.
%h Abbreviated month name.
%n Insert a newline.
%r Time as %I:%M:%S %p.
%R Time as %H:%M.
%t Insert a tab.
%T Time as %H:%M:%S.