Redirecting during a certain time frame

We need to put one of our websites into a ‘maintenance’ splash page and would like to automate the process as it will happen in the middle of the night. I’ve written an iRule that will redirect requests to an alternate site but am not sure if I can use something like CRON with an ‘at’ command in an iRule?

In searching the postings it looks like I need an iControl to do this? I don’t even know what an iControl is and I took 4 days worth of basic and advanced training.

Anyway, can somebody let me know if this is possible. Here is my iRule that I need to turn on at 9pm and turn off at 4am:

when HTTP_REQUEST {

if { [IP::remote_addr] contains “172” }

{

HTTP::redirect https://websiteforinternalusers.com/

}

else

{

HTTP::redirect http://maintenancewebsite.com/

}

}

This post on a similar topic: Click here

should get you started.

Post back if you have more questions.

Good luck!

/deb

That was perfect, thanks. Here’s my final rule for the record. Anybody who wants to redirect (most likely overnight as it is here) at a certain time for external IP’s should find this useful:

when HTTP_REQUEST {

set current_day [clock format [clock seconds] -format {%a} ]

set current_time [clock seconds]

set time_min [clock scan {21:00}]

set time_max [clock scan {04:00}]

if { [IP::remote_addr] contains “172” }

{

HTTP::redirect https://internalsite.com

}

elseif { (($current_day == {Mon}) and ($current_time > $time_min)) or (($current_day == {Tue}) and ($current_time < $time_max)) }

{

HTTP::redirect http://maintenancesplashpage.com/

}

}