in reply to automating a task

I would take another approach.

In the code of your dynamic website, I would add a check to the "eom_process" field in your database. If that field is not "ready", your script serves a static page "This site is now being maintained -- come back later" for your members. Meanwhile your colleague can do all maintenance required and when he is ready he sets the "eom_process" field to "ready" again and your members have access.

All you have to do is change that field to not "ready" when necessary. It would not take too much effort to write a small script to have a cron job do that for you.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: automating a task
by Marshall (Canon) on Jun 01, 2009 at 20:10 UTC
    I like this sort of idea. If you are shutting down the website, then a phased process is good. (1)Stop accepting new connections ("we are down for monthly maintenance at time X, expected time-up is time Y"). (2)For users logged in and doing things, try to find some "stopping point" so that their connection can be closed gracefully and their transactions wind up in a consistent state to the best of your program's knowledge. You will have to decide what to do if you can't get the users to log off themselves.

    The DB maintenance program that is gonna run may change things to the extent that any pending changes that you might be aware of won't work right. Anyway get the DB to what you figure is a consistent state.

    Rather than you shutting down at a specific time, you could have some I/F so that this maint program requests a shutdown, and when it is done, you reply back that you are shut down. When it is finished, it tells you that you can come back online. You want to come back up ASAP when it is finished. This I/F could be pretty simple with some file flags and perhaps some cell phone message if things stay down for too long.

    Anyway the shutdown from your end may take a variable amount of time. And obviously what this other thing does takes a variable amount of time.