PDA

View Full Version : Start/Stop service with wait


ASolovey
04-14-2010, 05:29 AM
Hi,

We'd like to control service during build procedure.
We need to stop it AND WAIT UNTIL it starts,
then we need to start it AND WAIT UNTIL it stops.

I don't see now how to do that.
The timeout option of "service" step doesn't do that.
It seems that this step simply waits this "timeout" checking the service to BEGIN DOING THE ACTION rather than wait for its completion.

The behavior is this:
We stop the service with timeout=15 sec, the service doesn't stop within this timeframe, but step succeeds immediately without any wait. Then we're trying to start the service and it of course says that the service is already running with no fail (noticed that latter is by design).

Could you please advise us:
1) How to wait until the service really completed the action?
2) how to check the state of the service and perform some other steps conditionally depending on its state?

Thanks!
P.S. We're using VBP 7.1

kinook
04-14-2010, 10:26 AM
The Service action does wait for the service status to change to SERVICE_RUNNING (when starting) or SERVICE_STOPPED (when stopping).

Use the Query status operation to check the service status and perform an action accordingly.
http://www.kinook.com/VisBuildPro/Manual/servicemaintab.htm

ASolovey
04-14-2010, 11:17 AM
Originally posted by kinook
Use the Query status operation to check the service status and perform an action accordingly.


Could you please advice me on how to perform some other steps conditionally depending on "query status" results?
This step as far as I see simply outputs some text to the build output.

kinook
04-14-2010, 11:22 AM
Check the value of the SERVICE_STATUS temporary macro.
http://www.kinook.com/VisBuildPro/Manual/servicemaintab.htm

ASolovey
04-14-2010, 11:28 AM
Thanks much!

By the way - there is no mention about SERVICE_STATUS temporary macro in the link you provided.
The offline help also has nothing about it...

kinook
04-14-2010, 11:33 AM
Refresh your browser, or download and install the latest build.

ASolovey
04-14-2010, 11:52 AM
Regarding a latest build - yah, we will consider this in the near future.
Regarding refreshing the browser - now is much better!

Thanks

Shiamak
05-14-2013, 01:37 PM
Is there a way to figure out if a NT service has been disabled? I looked into SERVICE_STATUS macro it doesnt store "disabled" value!!

kinook
05-14-2013, 02:30 PM
The Service action does not currently expose the startup type, but we'll add it to the request list.

Shiamak
05-14-2013, 02:51 PM
As always, Thanks a bunch for your prompt answer.. no wonder I am a fan of not only VisualBuild but also your post sale services..

Keep up the good work..

Shiamak
05-14-2013, 06:46 PM
Hello There,

Upon Querying a specific service, I dont see any values being assigned to SERVICE_STATUS macro...what I might be doing wrong?

kinook
05-14-2013, 07:24 PM
Not sure. It's working ok here (see attached sample).

5/14/2013 6:23:07 PM: -------------------- Starting Build: 'service_status.bld' --------------------
5/14/2013 6:23:07 PM: Building project step 1 - Project steps...
5/14/2013 6:23:07 PM: Building project step 2 - Service...
Querying service 'Windows Update'...
Status = Running
5/14/2013 6:23:07 PM: Building project step 3 - Show status...
SERVICE_STATUS = 4
5/14/2013 6:23:07 PM: Build successfully completed (elapsed = 00:00:00).

kinook
06-10-2013, 09:30 PM
Querying of the service start type is implemented in v8.4.
http://www.kinook.com/VisBuildPro/Manual/servicemaintab.htm

Shiamak
06-11-2013, 12:14 PM
Thanks a bunch for keeping up with old issues reported, your customer services and post sales services is perhaps the best I have come across.....keep up the good work..

Do you have a list of other features added to v8.4?

Best Regards

kinook
06-11-2013, 04:17 PM
http://www.kinook.com/Forum/showthread.php?t=5169

Shiamak
04-30-2014, 04:58 PM
What "operation" do you have to perfrom to get SERVICE_START_TYPE ?

I did try "Query Status" I did get the value of SERVICE_STATUS but VB did not recognize SERVICE_START_TYPE ??

kinook
04-30-2014, 05:31 PM
It is the Query status operation.
http://www.kinook.com/VisBuildPro/Manual/servicemaintab.htm

I tried it with the Windows Update service and got these temporary macros:
SERVICE_START_TYPE = 2
SERVICE_STATUS = 4

Shiamak
05-01-2014, 01:22 PM
It is the Query status operation.
http://www.kinook.com/VisBuildPro/Manual/servicemaintab.htm

I tried it with the Windows Update service and got these temporary macros:
SERVICE_START_TYPE = 2
SERVICE_STATUS = 4


I am still not seeing SERVICE_START_TYPE, though I do see SERVICE_STATUS, I am using VBP 8.6..

What I may be missing?

Shiamak
05-01-2014, 01:30 PM
I am still not seeing SERVICE_START_TYPE, though I do see SERVICE_STATUS, I am using VBP 8.6..

What I may be missing?

OK, you are right, when I attempted with wuauserv (windows update service) I got values for both system variables, but when I attempted the same with our custom NT service, I am only getting SERVICE_STATUS, whyz this?

kinook
05-01-2014, 05:52 PM
The Service action looks for the startup type in the registry at HKEY_LOCAL_MACHINE\System\CurrentControlSet\servic es\<servicename>
looking for a DWORD value named Start under that key. The action will attempt to convert the Service name property to the key name via the GetServiceKeyName (http://msdn.microsoft.com/en-us/library/windows/desktop/ms683229%28v=vs.85%29.aspx) API and use that if available.

Maybe that value isn't defined for your custom service?

Shiamak
05-01-2014, 06:23 PM
I do see DWORD value set as 2 in the registry for our custom services.......:-(..

I dont wanna spend time writing complete code to get status, so any help getting it done via VBP 8.6 is totally appreciated.

kinook
05-01-2014, 07:23 PM
Strange. In the latest build (VisBuildAct.dll 8.6.0.4), the Service action has been modified to use the QueryServiceConfig (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684932%28v=vs.85%29.aspx) API instead of a registry lookup to get the startup type. If that doesn't work, you might try using the Read Registry action (something like the attached).

Shiamak
05-01-2014, 07:30 PM
That is what I started doing since I got your last reply which has worked, how do I get the latest build? do I have to pay or update will be free?

kinook
05-01-2014, 07:32 PM
All 8.x updates are included with a v8 purchase. Latest version is at
http://www.kinook.com/VisBuildPro/download.html