You know how when a store is closing, they lock the doors so that new customers can't get in, but the existing ones can finish buying and get out?

That's what I want to do with my ecommerce site, to take it offline for maintenance.

Is there a way to redirect new visitors to a "down for maintenance" page, but "grandfather in" existing visitors for the next hour to let them finish shopping?