ytjPerl has asked for the wisdom of the Perl Monks concerning the following question:
use Win32::Service qw'GetStatus'; use strict; use POSIX; my @state_name = qw( Stopped START_PENDING STOP_PENDING Running CONTINUE_PENDING PAUSE_PENDING PAUSED ERROR ); my $filename = 'D:/log_script/recycle/StartupSvcList.txt'; open FILE, '<', $filename or die "cannot open"; while (<FILE>){ GetStatus("", $servicename, \%status); my $state_no = $status{'CurrentState'}; printf MYFILE " ServiceStatus: %s %s %s \n", "", $servicename, $st +ate_name[$state_no]; } close(MYFILE);
Thanks
Discipulus added a missing closing code tag
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: service status query with wrong status
by poj (Abbot) on Jan 17, 2018 at 16:15 UTC | |
|
Re: service status query with wrong status
by thanos1983 (Parson) on Jan 17, 2018 at 15:19 UTC | |
|
Re: service status query with wrong status
by karlgoethebier (Abbot) on Jan 19, 2018 at 10:27 UTC |