1. Welcome Guest! In order to create a new topic or reply to an existing one, you must register first. It is easy and free. Click here to sign up now!.
    Dismiss Notice

Startup Script but wait for SQL to start

Discussion in 'Windows Home Server' started by Steve Ikard, Apr 2, 2009.

  1. "Steve Ikard" <SteveIkard@discussions.microsoft.com> wrote in message
    news:88278DEC-1C8A-49E1-9EFA-A5DE8F1DF120@microsoft.com...
    > OK, your'e getting there... Label 3 shows that we do have a sucessful
    > find
    > that SQL Server has started...
    >
    > Test.txt:
    >
    > Thu 04/09/2009 11:49:35.64 (Main script)
    > Label 1 E:\Tools\StartTMIndexer.bat Thu 04/09/2009 11:49:35.68
    >
    >
    > Pinging ic-sbs2003.IkardConsulting.local [127.0.0.1] with 32 bytes of
    > data:
    >
    >
    >
    > Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    >
    > Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    >
    > Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    >
    >
    >
    > Ping statistics for 127.0.0.1:
    >
    > Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
    >
    > Approximate round trip times in milli-seconds:
    >
    > Minimum = 0ms, Maximum = 0ms, Average = 0ms
    >
    > Label 2 E:\Tools\StartTMIndexer.bat Thu 04/09/2009 11:49:37.75
    > MSSQLSERVER
    > Label 3 E:\Tools\StartTMIndexer.bat Thu 04/09/2009 11:49:37.90


    Seeing that things now I work as planned, I strongly suspect that you
    retyped my original batch files instead of copying/pasting them and that you
    missed a few things during the copy effort. Computers are much, much better
    at mindless copying than humans! I am now adding the last few lines of code
    (see below). There is a chance that the log file will not show the "Label 4"
    line - if so then I will suggest a further modification.

    @echo off
    :Loop
    echo Label 1 %0 %date% %time% >> c:\test.txt
    ping localhost -n 3 1>> c:\test.txt 2>>&1
    echo Label 2 %0 %date% %time% >> c:\test.txt
    net start | find /i "MSSQLSERVER" 1>>c:\test.txt 2>>&1
    if ErrorLevel 1 goto Loop
    echo Label 3 %0 %date% %time% >> c:\test.txt
    \\ic-sbs2003\apps\tmw9e\tmdatndxe.exe ^
    /data=\\ic-sbs2003\Apps\tmw9e\Data 1>>c:\test.txt 2>>&1
    echo Label 4 %0 %date% %time% >> c:\test.txt
     
  2. Steve Ikard

    Steve Ikard Guest

    This thing is going to be the death of me...

    Now test.txt shows only 2 lines -- the Ping didn't even take place:
    Thu 04/09/2009 13:11:49.01 (Main script)
    Label 1 E:\Tools\StartTMIndexer.bat Thu 04/09/2009 13:11:49.04

    That's all it shows. I ran it twice just to make sure.

    Here is the StartTMIndexer.bat that I copied and pasted from your last post:
    @echo off
    :Loop
    echo Label 1 %0 %date% %time% >> c:\test.txt
    ping localhost -n 3 1>> c:\test.txt 2>>&1
    echo Label 2 %0 %date% %time% >> c:\test.txt
    net start | find /i "MSSQLSERVER" 1>>c:\test.txt 2>>&1
    if ErrorLevel 1 goto Loop
    echo Label 3 %0 %date% %time% >> c:\test.txt
    \\ic-sbs2003\apps\tmw9e\tmdatndxe.exe /data=\\ic-sbs2003\Apps\tmw9e\Data
    1>>c:\test.txt 2>>&1
    echo Label 4 %0 %date% %time% >> c:\test.txt

    You must be getting pretty sick that you ever responded to this posting...


    "Pegasus [MVP]" wrote:

    >
    > "Steve Ikard" <SteveIkard@discussions.microsoft.com> wrote in message
    > news:88278DEC-1C8A-49E1-9EFA-A5DE8F1DF120@microsoft.com...
    > > OK, your'e getting there... Label 3 shows that we do have a sucessful
    > > find
    > > that SQL Server has started...
    > >
    > > Test.txt:
    > >
    > > Thu 04/09/2009 11:49:35.64 (Main script)
    > > Label 1 E:\Tools\StartTMIndexer.bat Thu 04/09/2009 11:49:35.68
    > >
    > >
    > > Pinging ic-sbs2003.IkardConsulting.local [127.0.0.1] with 32 bytes of
    > > data:
    > >
    > >
    > >
    > > Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    > >
    > > Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    > >
    > > Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    > >
    > >
    > >
    > > Ping statistics for 127.0.0.1:
    > >
    > > Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
    > >
    > > Approximate round trip times in milli-seconds:
    > >
    > > Minimum = 0ms, Maximum = 0ms, Average = 0ms
    > >
    > > Label 2 E:\Tools\StartTMIndexer.bat Thu 04/09/2009 11:49:37.75
    > > MSSQLSERVER
    > > Label 3 E:\Tools\StartTMIndexer.bat Thu 04/09/2009 11:49:37.90

    >
    > Seeing that things now I work as planned, I strongly suspect that you
    > retyped my original batch files instead of copying/pasting them and that you
    > missed a few things during the copy effort. Computers are much, much better
    > at mindless copying than humans! I am now adding the last few lines of code
    > (see below). There is a chance that the log file will not show the "Label 4"
    > line - if so then I will suggest a further modification.
    >
    > @echo off
    > :Loop
    > echo Label 1 %0 %date% %time% >> c:\test.txt
    > ping localhost -n 3 1>> c:\test.txt 2>>&1
    > echo Label 2 %0 %date% %time% >> c:\test.txt
    > net start | find /i "MSSQLSERVER" 1>>c:\test.txt 2>>&1
    > if ErrorLevel 1 goto Loop
    > echo Label 3 %0 %date% %time% >> c:\test.txt
    > \\ic-sbs2003\apps\tmw9e\tmdatndxe.exe ^
    > /data=\\ic-sbs2003\Apps\tmw9e\Data 1>>c:\test.txt 2>>&1
    > echo Label 4 %0 %date% %time% >> c:\test.txt
    >
    >
    >
     
  3. You must now go back exactly one step in order to repeat the last successful
    test, then build things up in even smaller steps. I can't do this for you -
    you are a server administrator, same as I, and you are equipped with a good
    dose of logical thinking ability!

    Remember - the test before this last one worked. Go back to it!


    "Steve Ikard" <SteveIkard@discussions.microsoft.com> wrote in message
    news:36004F64-D220-4C6C-BDA7-ADEB07F2366F@microsoft.com...
    > This thing is going to be the death of me...
    >
    > Now test.txt shows only 2 lines -- the Ping didn't even take place:
    > Thu 04/09/2009 13:11:49.01 (Main script)
    > Label 1 E:\Tools\StartTMIndexer.bat Thu 04/09/2009 13:11:49.04
    >
    > That's all it shows. I ran it twice just to make sure.
    >
    > Here is the StartTMIndexer.bat that I copied and pasted from your last
    > post:
    > @echo off
    > :Loop
    > echo Label 1 %0 %date% %time% >> c:\test.txt
    > ping localhost -n 3 1>> c:\test.txt 2>>&1
    > echo Label 2 %0 %date% %time% >> c:\test.txt
    > net start | find /i "MSSQLSERVER" 1>>c:\test.txt 2>>&1
    > if ErrorLevel 1 goto Loop
    > echo Label 3 %0 %date% %time% >> c:\test.txt
    > \\ic-sbs2003\apps\tmw9e\tmdatndxe.exe /data=\\ic-sbs2003\Apps\tmw9e\Data
    > 1>>c:\test.txt 2>>&1
    > echo Label 4 %0 %date% %time% >> c:\test.txt
    >
    > You must be getting pretty sick that you ever responded to this posting...
    >
    >
    > "Pegasus [MVP]" wrote:
    >
    >>
    >> "Steve Ikard" <SteveIkard@discussions.microsoft.com> wrote in message
    >> news:88278DEC-1C8A-49E1-9EFA-A5DE8F1DF120@microsoft.com...
    >> > OK, your'e getting there... Label 3 shows that we do have a sucessful
    >> > find
    >> > that SQL Server has started...
    >> >
    >> > Test.txt:
    >> >
    >> > Thu 04/09/2009 11:49:35.64 (Main script)
    >> > Label 1 E:\Tools\StartTMIndexer.bat Thu 04/09/2009 11:49:35.68
    >> >
    >> >
    >> > Pinging ic-sbs2003.IkardConsulting.local [127.0.0.1] with 32 bytes of
    >> > data:
    >> >
    >> >
    >> >
    >> > Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    >> >
    >> > Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    >> >
    >> > Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
    >> >
    >> >
    >> >
    >> > Ping statistics for 127.0.0.1:
    >> >
    >> > Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
    >> >
    >> > Approximate round trip times in milli-seconds:
    >> >
    >> > Minimum = 0ms, Maximum = 0ms, Average = 0ms
    >> >
    >> > Label 2 E:\Tools\StartTMIndexer.bat Thu 04/09/2009 11:49:37.75
    >> > MSSQLSERVER
    >> > Label 3 E:\Tools\StartTMIndexer.bat Thu 04/09/2009 11:49:37.90

    >>
    >> Seeing that things now I work as planned, I strongly suspect that you
    >> retyped my original batch files instead of copying/pasting them and that
    >> you
    >> missed a few things during the copy effort. Computers are much, much
    >> better
    >> at mindless copying than humans! I am now adding the last few lines of
    >> code
    >> (see below). There is a chance that the log file will not show the "Label
    >> 4"
    >> line - if so then I will suggest a further modification.
    >>
    >> @echo off
    >> :Loop
    >> echo Label 1 %0 %date% %time% >> c:\test.txt
    >> ping localhost -n 3 1>> c:\test.txt 2>>&1
    >> echo Label 2 %0 %date% %time% >> c:\test.txt
    >> net start | find /i "MSSQLSERVER" 1>>c:\test.txt 2>>&1
    >> if ErrorLevel 1 goto Loop
    >> echo Label 3 %0 %date% %time% >> c:\test.txt
    >> \\ic-sbs2003\apps\tmw9e\tmdatndxe.exe ^
    >> /data=\\ic-sbs2003\Apps\tmw9e\Data 1>>c:\test.txt 2>>&1
    >> echo Label 4 %0 %date% %time% >> c:\test.txt
    >>
    >>
    >>
     
  4. "Steve Ikard" <SteveIkard@discussions.microsoft.com> wrote in message
    news:36004F64-D220-4C6C-BDA7-ADEB07F2366F@microsoft.com...
    > This thing is going to be the death of me...
    >
    > Now test.txt shows only 2 lines -- the Ping didn't even take place:
    > Thu 04/09/2009 13:11:49.01 (Main script)
    > Label 1 E:\Tools\StartTMIndexer.bat Thu 04/09/2009 13:11:49.04
    >
    > That's all it shows. I ran it twice just to make sure.


    I suppose you're aware of the fatal trap of changing more than one thing at
    a time while trouble-shooting? Your batch file might be perfectly OK but the
    problem could be caused by some other thing you changed at the same time,
    something you haven't revealed so far.
     

Share This Page