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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dependency of two NT services not on the same box 1

Status
Not open for further replies.

alext613

Programmer
Joined
Jun 16, 2004
Messages
4
Location
US
Dear Gurus,

Let's say I have NT service A on one box on the network and NT service B on a
*different* box on the network. Both services are running a *java*
application. The first java app is actually a weblogic server on a particular
port and the other is an application that needs weblogic to be running in order
to start properly.

What do you think is the best way to ensure that A goes on first, and then B?
If it was on the same box, it'd be easy, but in this case it's on a different
box, though on the same network.

Alex
 
The best way would be to move both services to the same server.

The way around this though is to handle the processes that would cause the dependant service to be started when the primary service hasn't.

For example - if both servers are off, and Server B starts, then dependant service will fail - presumably non-catastrophically, but simply remain stopped. The solution is to have a batch file run from the registry's HKLM\Software\Microsoft\Windows\CurrentVersion\Run key that tries to start the dependant service on Server B (this is possible, consult NET USE /? for details)

This is one example. Set out the different scenarios that could occur where the dependent service is starting but the primary service is stopped, and how to handle them.
 
Thanks so much for your reply.
Would you mind elaborating, though. How does this registry entry allow me to make sure that service on box A starts first?
Alex
 
I didn't make it clear, but the registry key is on Server A. That particular key is looked at when Windows starts - not when anybody logs on. So you simply add a string value to that key. The name of it can be anything, but the value of it should be a full path to this batch file - that is stored somewhere on Server A. That way, your batch file runs whenever Server A starts.

But - I've screwed up. I meant to say use NET START in the batch file, and unfortunately NT4 doesn't allow remote service starting.
Don't worry though, just go here: and download this little freeware proggy that will let you remotely start services.
 
Griffyn,
Thank you for your swift and thorough reply, I got a few follow up questions.

1) I got windows 2000 server - does that allow remote service starting?

2) How do I ensure that batch for service B is triggered off AFTER service A starts up when the server A is rebooted.

3) What if, instead of service B depending on the service A running on server A, it would be dependent on a certain url being successfully accessible? What's the best way to do that?

Thank so much again.
Alex
 
1. You're in the wrong forum for W2K server - but I do have a W2K server, and it's NET START command also doesn't allow remote usage.

2. A batch file is the simplest type of program to use - and you're right, there's no guarantee that service A will have started when it get's executed. If you are capable, try writing a small service application yourself that runs on Server A, and is dependant on Service A, and it's function is to simply launch the PSService proggy to run Service B.

3. I'd look at writing a service application again for this. Make Service B dependant on it, and have your service fail to start if the URL isn't accessible.

It's not uncommon to use services like this, and they're called Helper services, as their function is limited to only ensuring other services work.
 
Thanks again,

Let me ask you a couple more questions, then, if you don't mind.
1) Based on your suggestions, I was thinking of writing a batch program that would hit the A-based url that needs to be working before I can turn on service b, i.e. "explorer and then invoke the little utility to start up the service on B. So I thought if I just do "explorer I would get back an error code of more than 1 or more if I the url doesn't work (then if the errorlevel returned would be 0, I would envoke the utility command to start the service.) The problem is that even if I get page not found, the errorlevel being returned is 0. Any thoughts?
2) Somewhat similar but unrelated question. Say I have nt service Yo and Joe on the same box. I always want Yo to start first and then Joe. So I thought, if I set up the DependOnService parameter on Joe to point to Yo, I should be all set and everytime I try to start Joe, it would start Yo first. The problem is it doesn't. True if I stop Yo, it stops Joe, so that works fine, but when I start Joe it does not start Yo. Any sugestions?

Alex
 
Can't help you out on either of those problems. A 404 error wouldn't be reported to explorer - it's not that kind of error.

And on your second question - it sounds like you've got it set up correctly, and it should work as you think it should. I don't have any suggestions for you, sorry.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top