Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with starting a service with a batch file 1

Status
Not open for further replies.

cmiddl1

IS-IT--Management
Oct 16, 2003
20
US
Hi,

Here are the problems that I would appreciate some assistance with.

1. I have a third-party application that relies on SQL, and is listed in the service panel, but cannot be started with the "automatic" option because it needs to "see" that the SQL server/service has already started. The main issue is in the case that the server is rebooted, this process does not startup.

2. My question is: Is there a way that I can set this application to "see" that SQL has started, then have it start?
3. Is there a way to create a bacth file that will do this, either using Kixtart or Perl?
 
A batch file (or a script file) can use the DOS 'start' command to start any service.

Look up the details in the help file.

Most services will simply error this command if they are already started but try it with sql server first to see what happens just to be on the safe side. If you use VBScript you can try to open an ADO connection to the database and loop until it is successful at which point you can load the 3rd party application.





Bob Boffin
 
I would recommend setting the service dependency for the 3rd party service so that it depends on the SQL Server. This way it will not start until the SQL Service has started.

This is a reg tweak and probably isn't supported by anyone, but "should" work.

Open regedt32 (You have to use this, regedit won't work).
Navigate to HKLM\system\CurrentControlSet\Services\{Your Service Name}
If there is a DependOnService key edit it and add "MSSQLSERVER", if not create it as a REG_MULTI_SZ and put "MSSQLSERVER" in the box. With out the quotes in both cases.

You can verify that this worked by checking in the services control pannel.


Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
 
First, I want to thank both bboffin and mrdenny for their input. Denny, your suggestion worked like a charm and I appreciate the registry hack that inabled me to resolve this issue. Tek-Tips RULES!!

Craig
 
Denny rules...give him a star. Nice tip Mr D.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Thanks guys. I thought that might come in handy. Me thinks that should be a FAQ. It took me a while to find the settings. Wouldn't want to have to hunt them down again.

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
 
Here is the FAQ for easy viewing.

faq962-5509 :)

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top