smanicka has asked for the wisdom of the Perl Monks concerning the following question:
Here's something I want to throw out.I am feeling real dumb about this.I have a script that I want to run as a win32 service.After looking at a lot of ption (srvany.exe, win32::deamonize etc) I decided that it would probably be a lot easier to just buy PDK 7.5 and use the perlsvc utility to create the service.
i found a tutorial @ http://ivoronline.com/Programming/PERL/Tutorials/PERL%20-%20Support%20-%20PerlSvc.php
so if my code isWhere would i place my code in the code that they have provided if i need to get it to run as a service? Their code is#!usr/bin/perl use modules XYZ while(1){ DO ABC }
Thanks -SandhyaMyService.pl package PerlSvc; $PerlSvc::Name = "MyService"; #Short name by which your service is known. $PerlSvc::DisplayName = "MyService Display"; #Display name in W +indows Control Panel. sub PerlSvc::Startup(){ #Function called when the service is started. my $exitloop = 1; my $sleep = 1; while ($exitloop) { $outputFile = "C:/TEMP/Perl/myservice.log"; if(!open(myOutput, ">>$outputFile ")) { print("Could not open" +.$outputFile); } print(myOutput localtime(time)."\n"); print localtime(time)."\n"; close(myOutput ); sleep $sleep; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perlscv help required.
by Anonymous Monk on Feb 06, 2009 at 19:46 UTC | |
by smanicka (Scribe) on Feb 06, 2009 at 22:14 UTC | |
by Anonymous Monk on Feb 07, 2009 at 04:40 UTC | |
|
Re: perlscv help required.
by Bloodnok (Vicar) on Feb 07, 2009 at 01:58 UTC |