Bring Application Online / Offline

I've a timer that runs every night and takes arround 1h to finish, and I'd like to put the application in "maintenance" mode during that time.

How can I, programmatically, bring the application offline and online again?

And is there a simple way to change the content of the page that appears when a users goes to a application that is offline (Application Temporarily Unavailable) ?

Hi Carlos,

A simple, yet effective approach is to store in DB a variable that indicates if the site is under maintenance or not. On timer run this var gets updated to true, then on every preparation screen you do a quick check, if under maintenance redirect to a specific page. At the end of timer logic, set back the var to false.

Hope this helps.

Hi Carlos,

Adding to what Kelter wrote, you may do this logic in the screen layout (Common \ Layout_Normal by default), so you would only implement it once. Your maintenance screen would then use another layout, for avoiding an infinite redirect loop.
Hi ,

I agree with the approach, but since in version 7 of the platform the taking offline / online is there by design in service center, I didn't want to re-invent the wheel, but better leverage the platform.

Thanks for the help,
Hi Carlos,

I do believe that if you take your application offline, you won't be able to execute its timers.
You also might want to take a look at this topic (although it's not meant for taking just one app offline, but the whole server):

Hi Carlos,

There is no programatic way to se the online/offline property of applications, only manually in Service Center.
Also you would need to be carefull, because Timers of offline applications also do not run (it's offline), so the timer would have to belong to a different application.

The sugestion that Miguel/Paulo gave looks the way to go.

João Rosado