Results 1 to 4 of 4
  1. #1
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Batch file to change main.asp

    Having worked yet another Sunday (yes part of Easter Sunday) on a SAN reboot that effected my system we held a lessons learnt meeting today to go through some options and ideas. It appears that there were approximately 15 servers effected and each one had a main index page set as a default within each inetmgr. The poor old network guy had to go through each of these servers and change the default page over to a holding page stating that each of the services it was provided was temporarily unavailable.

    At the meeting he came up with what sounds like a reasonable idea and as of yet never tried with in our offices. His idea was to have the main.asp (default) running as normal and within the root folder another one called ( for sake of argument) hold.asp then create a little batch file that had the ability to

    1) Stop web services
    2) Rename main.asp to main.bak
    3) Rename hold.asp to to main.asp
    4) Start web services

    Another batch file would reverse the above items 1-4

    Now this whole thing has issues as this would prevent "new" log ins from logging on but any users already in the system whould still have database connectivity. I know a way around this by clearing the SQL sessions table but outside the scope of this question and this forum

    Do you think items 1 to 4 have legs and if not can you thinks of any problems or is it a dangerous game to play (although I always create back up routines prior to these little jaunts)
    Jerry

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Batch file to change main.asp

    I'm not sure you need to stop the web server just to overwrite main.asp. I edit ASP pages in Wordpad all the time without bothering to stop any parts of IIS. Perhaps that's rash? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  3. #3
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Batch file to change main.asp

    I was in on Easter Saturday, too!

    For that requirement, I would always use COPY <source> <target> (one step) rather than RENAME (two steps), because you always have the two possible source files available to you, and the end state is simply a matter of determining whether or not the copy worked.

    Use SC or PsService to stop and start the services. As I remember it, you have to process the message output from both programs to determine success or failure rather than relying on an errorlevel (which annoyingly is not produced).

    Do you want some example BATch files?

    John

    PS <pedant warning!> I get so cross when people use effect where they should use affect...!
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  4. #4
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Batch file to change main.asp

    Jefferson

    Thanks, the application in question requires that each change to application files requires a iisreset so that the cache is cleared and the end user gets the refreshed data. I would rather not overwrite main.asp as it it is the main login screen that calls and pulls in a powerpage

    John

    Thanks for the offer of the code, my network guy is happy to do it , just unsure of the consequences. I have shown him your note about copy and he has nodded and understood and will now see how the application is affected <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Jerry

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •