Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Help with Win32::Service

by AcidHawk (Vicar)
on Dec 14, 2003 at 06:22 UTC ( #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
Node Status?
node history
Node Type: note [id://314617]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2021-03-07 12:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (121 votes). Check out past polls.

    Notices?