ActiveState Community

Set recovery options on Perl service using PerlSvc.exe

Posted by mrizzo on 2009-05-05 12:06
OS: All / Any

I have successfully created a Windows Perl service using the PDK and PerlSvc.exe. I am now trying to customize the service options that get set when you run the --install. I see where the description, service name and display name get set, but I do not see any documentation as to where I would set the options on the Recovery tab of the Service. There are three options there that I am interested with, First Failure, Second Failure, and Subsequent Failures. I want to the service to restart itself any time if fails. It is a system monitor service and I want to make sure that it restarts if for any reason it crashed.

Can someone give me any ideas as to where this would be set in the Perl file, and what the options to set would be. This is what my Options section looks like currently:

sub configure {

%Config = (ServiceName => $service,
DisplayName => "Vue System Monitor",
Parameters => "--host $host --delay $delay",
Description => "Monitors the readers, clients,");
}

My assumption would be that I could put in FirstFailure => "Restart", but I am not sure this is the correct syntax.

Thanks for any input anyone can share.

Mike

AttachmentSize
recovery_service.jpg20.96 KB

dfmatt | Mon, 2009-07-27 09:32

I don't know of anyway that you can do this with the PerlSvc interface, but WMI should be able to do this.

Using the module Win32::OLE you can interface with WMI and then use that during the InstallService sub to set your recovery options.

Do a search for WMI recovery to see how that'd be done (I've never done it, but a quick search shows it looks possible, most stuff is with WMI!).