Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Help with Win32::Service

by AcidHawk (Vicar)
on Dec 14, 2003 at 06:22 UTC ( [id://314617]=note: print w/replies, xml ) Need Help??


in reply to Help with Win32::Service

Your script does stop the service. However, you only do Win32::Service::GetStatus("", $svc, \%statusHash); once before you try to stop the service and then after you stop the service you don't ask for the status again. So actually you need something like this.

... Win32::Service::GetStatus("", $svc, \%statusHash); #if ($statusHash{"CurrentState"} =~ /4/){ print "$svc" . " is currently " . $statcodeHash{$statusHash{"CurrentSt +ate"}} . "\n"; #} if (Win32::Service::StopService('', $svc)) { sleep (3); Win32::Service::GetStatus("", $svc, \%statusHash); print "$svc" . " is currently " . $statcodeHash{$statusHash{"Curre +ntState"}} . "\n"; } else { print "Error ... $^E\n"; }
I have to wait at least 3 seconds before I can check the current status of the service before I can see that the status has changed.

-----
Of all the things I've lost in my life, its my mind I miss the most.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://314617]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-25 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found