PC Review


Reply
Thread Tools Rate Thread

Conditionally starting a service

 
 
zipobibrok5X10e8
Guest
Posts: n/a
 
      31st Jul 2006
Hi All ,

Hope this is the right group.

I want to start a service only if another service has been started. How
do I do that using the net start command ? Sorry if the question is
repeated.

net start | find /i "Alerter">nul||net start "ASP.NET State Service"

I want the command to work such that , only if the Alerter service has
started , I want ASP.NET to start.

In short I want something like this to be done :

if(Service 1 has started)
Start Service 2.
else
Do not start Service 2.

How do I accomplish this?

Thank You.

 
Reply With Quote
 
 
 
 
Jerold Schulman
Guest
Posts: n/a
 
      31st Jul 2006
On 31 Jul 2006 01:14:02 -0700, "zipobibrok5X10e8" <(E-Mail Removed)> wrote:

>Hi All ,
>
>Hope this is the right group.
>
>I want to start a service only if another service has been started. How
>do I do that using the net start command ? Sorry if the question is
>repeated.
>
>net start | find /i "Alerter">nul||net start "ASP.NET State Service"
>
>I want the command to work such that , only if the Alerter service has
>started , I want ASP.NET to start.
>
>In short I want something like this to be done :
>
>if(Service 1 has started)
> Start Service 2.
>else
> Do not start Service 2.
>
>How do I accomplish this?
>
>Thank You.


Using the service display names for both the find and net start, not the service short name (key):

for /f "Tokens=*" %%a in ('net start^|Find /i "Alerter"') do (
net start "ASP.NET State Service"
)

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 
Reply With Quote
 
foxidrive
Guest
Posts: n/a
 
      31st Jul 2006
On Mon, 31 Jul 2006 08:40:46 -0400, Jerold Schulman wrote:

> On 31 Jul 2006 01:14:02 -0700, "zipobibrok5X10e8" <(E-Mail Removed)> wrote:
>
>>Hi All ,
>>
>>Hope this is the right group.
>>
>>I want to start a service only if another service has been started. How
>>do I do that using the net start command ? Sorry if the question is
>>repeated.



>>net start | find /i "Alerter">nul||net start "ASP.NET State Service"


net start|find /i "Alerter">nul&&net start "ASP.NET State Service"

I think that's another option.
 
Reply With Quote
 
Dave Patrick
Guest
Posts: n/a
 
      31st Jul 2006
This article may also help.

http://support.microsoft.com/default.aspx?scid=kb;[LN];193888

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"zipobibrok5X10e8" wrote:
| Hi All ,
|
| Hope this is the right group.
|
| I want to start a service only if another service has been started. How
| do I do that using the net start command ? Sorry if the question is
| repeated.
|
| net start | find /i "Alerter">nul||net start "ASP.NET State Service"
|
| I want the command to work such that , only if the Alerter service has
| started , I want ASP.NET to start.
|
| In short I want something like this to be done :
|
| if(Service 1 has started)
| Start Service 2.
| else
| Do not start Service 2.
|
| How do I accomplish this?
|
| Thank You.
|


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"The service did not start due to a logon failure" when starting a custom service. Radu Microsoft Dot NET 2 7th Apr 2006 06:01 AM
Conditionally starting programs based on profile =?Utf-8?B?Sy4gTS4gSm9uZXM=?= Windows XP Setup 5 10th Jan 2006 11:40 PM
re-starting rpc service jason Microsoft Windows 2000 Applications 1 26th Aug 2004 03:32 PM
The <service> service hung on starting. / Service started successfully. =?Utf-8?B?cm9iX3Nhcw==?= Microsoft Dot NET 0 12th Feb 2004 10:21 PM
The License Logging Service service hung on starting Jair Gerald Microsoft Windows 2000 Active Directory 0 1st Oct 2003 06:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:03 PM.