Re: Startup Script but wait for SQL to start
- From: Steve Ikard <SteveIkard@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 8 Apr 2009 13:51:02 -0700
Still don't see enough to be able to figure out what's wrong.
Main batch file (StartupScript.bat):
@echo off
echo %date% %time% %UserName% (Main script) >>c:\test.txt
start /b "Indexer" "E:\Tools\StartTMIndexer.bat"
2nd batch file (StartTMIndexer.bat):
@echo off
:Loop
echo %date% %time% %UserName% (Loop) >> c:\test.txt
ping localhost -n 30 1>>c:test.txt 2>>&1
net start | find /i "MSSQLSERVER" 1>>c:test.txt 2>>&1
if Errorlevel 1 goto Loop
echo %date% %time% %UserName% (After Loop) >> c:\test.txt
\\IC-SBS2003\Apps\tmw9e\tmdatndxe.exe /data=\\IC-SBS2003\Apps\tmw9e\Data
1>>c:\test.txt 2>>&1
When I test from GP Startup Script here is what test.txt contains:
Wed 04/08/2009 12:20:55.45 (Main script)
Wed 04/08/2009 12:20:55.51 (Loop)
And it does not start up my Indexer program -- since I guess it never gets
to the "After Loop" stmt.
When I test from CMD here is what test.txt contains:
Wed 04/08/2009 13:22:32.65 administrator (Main script)
Wed 04/08/2009 13:22:32.67 administrator (Loop)
Wed 04/08/2009 13:23:01.75 administrator (After Loop)
And it sucessfully starts up the Indexer.
The lines that you had me add "1>>c:\test.txt 2>>&1" don't show anything in
test.txt. Do I have the syntax correct? What exactly are they supposed to
show?
Thanks, again, for your patience in helping me solve this problem. There
are a lot of users who could benefit from the Indexer starting up
automatically at server boot up time.
"Pegasus [MVP]" wrote:
A couple of observations:.
- If you see only one single log line of the form
Mon 04/06/2009 16:35:19.09 (Loop)
then the program hangs inside the loop. Otherwise
there should me many of these messages! You now
need to debug the loop, e.g. like so:
1. @echo off
2. :Loop
3. echo %date% %time% %UserName% (Loop) >> c:\test.txt
4. ping localhost -n 30 1>>c:\test.txt 2>>&1
5. net start |find /i "MSSQLSERVER" 1>>c:\test.txt 2>>&1
6. if Errorlevel 1 goto Loop
7. echo %date% %time% %UserName% (After loop) >> c:\test.txt
8. \\ic-sbs2003\apps\tmw9e\tmdatndxe.exe /data=\\ic-sbs2003\Apps\tmw9e\Data
1>>c:\test.txt 2>>&1
Your question about the last line: Well, I tried very hard to number each
line of code so that you could see clearly where each of them starts and
ends, which is important when your newsreader wraps long lines.
Unfortunately this did not prevent you from considering the last line as a
separate line. It isn't - it is the tail end of Line 8! Its purpose is to
capture standard and error output in our log file c:\test.txt.
"Steve Ikard" <SteveIkard@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:104DF28F-A025-4965-96FF-BAF0ADD34D96@xxxxxxxxxxxxxxxx
Thanks for getting back to me on Friday night. I have been away so this
is
my first chance to get back to this problem. The test.txt says...
Mon 04/06/2009 16:35:19.03 (Main script)
Mon 04/06/2009 16:35:19.09 (Loop)
And that's all. It never gets to the "(After Loop)" so it never starts
the
indexer program.
BTW, what does the last line do? ("1>>c:\test.txt 2>>&1")
"Pegasus [MVP]" wrote:
"Steve Ikard" <SteveIkard@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5C5B820A-8C1A-4014-974E-9DC790ADC685@xxxxxxxxxxxxxxxx
OK, I opened up a Command Prompt screen and ran StartupScript.bat. (I
Rem'd
echo off in both batch files so I could see what was going on.) It
sucessfully called StartTMIndexer.bat. It started the Indexer just
fine.
When I used the executable line without the "start /b" it did what you
had
questioned -- tmdatndxe.exe prevented the calling batch file from
closing.
I
changed the line to "start /b "" \\ic=sbs2003\Apps......" and it worked
fine.
So, I'm still left wondering why it won't work in the Group Policy
Startup
Script...
You now add some debugging code like so:
@echo off
echo %date% %time% %UserName% (Main script) >> c:\test.txt
start /b "Indexer" "E:\Tools\StartTMIndexer.bat"
The file E:\Tools\StartTMIndexer.bat must contain these lines:
1. @echo off
2. :Loop
3. echo %date% %time% %UserName% (Loop) >> c:\test.txt
4. ping localhost -n 30 > nul
5. net start |find /i "MSSQLSERVER" || Goto Loop
6. echo %date% %time% %UserName% (After loop) >> c:\test.txt
7. \\ic-sbs2003\apps\tmw9e\tmdatndxe.exe
/data=\\ic-sbs2003\Apps\tmw9e\Data
1>>c:\test.txt 2>>&1
I have added line numbers so that you can see where each new line starts.
What does the log file c:\test.txt report?
- Follow-Ups:
- Re: Startup Script but wait for SQL to start
- From: Pegasus [MVP]
- Re: Startup Script but wait for SQL to start
- References:
- Startup Script but wait for SQL to start
- From: Steve Ikard
- Re: Startup Script but wait for SQL to start
- From: Pegasus [MVP]
- Re: Startup Script but wait for SQL to start
- From: Steve Ikard
- Re: Startup Script but wait for SQL to start
- From: Pegasus [MVP]
- Re: Startup Script but wait for SQL to start
- From: Steve Ikard
- Re: Startup Script but wait for SQL to start
- From: Pegasus [MVP]
- Re: Startup Script but wait for SQL to start
- From: Steve Ikard
- Re: Startup Script but wait for SQL to start
- From: Pegasus [MVP]
- Re: Startup Script but wait for SQL to start
- From: Steve Ikard
- Re: Startup Script but wait for SQL to start
- From: Pegasus [MVP]
- Re: Startup Script but wait for SQL to start
- From: Steve Ikard
- Re: Startup Script but wait for SQL to start
- From: Pegasus [MVP]
- Startup Script but wait for SQL to start
- Prev by Date: help with windows time service
- Next by Date: Re: Startup Script but wait for SQL to start
- Previous by thread: Re: Startup Script but wait for SQL to start
- Next by thread: Re: Startup Script but wait for SQL to start
- Index(es):
Relevant Pages
|