Home: Perl Programming Help: Win32 Programming Help:
Using Win32::service module



anamika
Deleted

Jul 20, 2000, 2:21 PM


Views: 14007
Using Win32::service module

hello,

Pls can somebody tell how to use this module
i have used it in my package but not got the
result. pls help.

Also any existing module to resolve the NT and UNIX Operating system issues. checked
CPAN - did not find any. if anybody aware
of module. please provide links to the source.

Thanks


dws
Deleted

Jul 20, 2000, 2:39 PM


Views: 14007
Re: Using Win32::service module

Post a code fragment that shows how you're trying to use the module.

And please try to be more specific on the second question. "Resolve the NT and Unix Operating system issues" is too vague. What issues are you tring to resolve?


anamika
Deleted

Jul 21, 2000, 6:36 AM


Views: 14007
Re: Using Win32::service module

i have tried to get the services running on my NT box and also i want to get the status
of running service but i am not able to.

i have said
use Win32::Services and also used the functions in this module - the Get services and the Get status .

Any clues.

i have the module installed in the library- i
checked that out.



saravanansrivai
Deleted

Aug 1, 2000, 12:54 PM


Views: 14007
Re: Using Win32::service module

These are routines i have used on my script for starting & stopping & Getting the status of "mysql" service.U can customize it for any service.

Win32::Service;

#### Check mysql service status,return true if the servcie is running
sub mysqlStatus {

## Check Win32 Services

#Win32::Service::GetServices("",\%srvs);

Win32::Service::GetStatus("",$srv,\%status);
#print ("Service= $srv\n\n");
#foreach $key2 (sort keys %status) {print ("Status=$key2===>$status{$key2}\n");}
if ($status{'CurrentState'}==4){print "Mysql service is Running!!!\n";return 1;} else {print "Mysql service is not Running!!!\n";return 0;}
}

#### Stop mysql service status,return true if the servcie is Stopped
sub mysqlStop {
print "Stopping Mysql service !!!\n";
print ACTLOG ("Stopping Mysql service !!!\n");
Win32::Service::StopService("","$srv");
Win32::Service::GetStatus("","$srv",\%status);

if ($my_srv{CurrentState}==1) {
return 1;
} else {
return 0;}
}

#### Start mysql service status,return true if the servcie is Started
sub mysqlStart {
print "Starting Mysql service !!!\n";
print ACTLOG ("Starting Mysql service !!!\n");
Win32::Service::StartService("","$srv");
Win32::Service::GetStatus("","$srv",\%status);

if ($my_srv{CurrentState}==4) {
return 1;
} else {
return 0;}
}



anamika
Deleted

Aug 1, 2000, 10:04 PM


Views: 14007
Re: Using Win32::service module

hello,

thanx - i got the result by using the win32::services this is using the service names- i used the srvice display name earlier

thanks