ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pdk
pdk
Re: PerlSvc questions
by Jan Dubois other posts by this author
Feb 28 2002 8:06PM messages near this date
RE: PerlSvc questions | Re: Windows installer woes (Hurray!)
On Thu, 28 Feb 2002 14:06:56 -0500, "David Hares" <dhares@[...].net> 
wrote:

> >I don't think so.  You could write information to a file or the registry
> >during install time and read it back at Startup time.  Could you explain
> >why you need this?
> 
> Sure.  I need to run multiple copies of the same script as a service, but of course two ser
vices cannot share the same name.  I
> could build multiple exe files with PerlSvc::Name defined differently in each, but I'd rath
er not.  I discovered that you can add
> more arguements on the startup line beyond "foo -install" and access them (was this intende
d?).  Thus, my install command looks like
> "foo -install -svcname=FOO1 -cfgfile=foo1.cfg".  Sure enough, I can use GetOpt to get svcna
me, set PerlSvc::Name, and service FOO1
> is installed and can be started.  Unfortunately, the code loses the install context, you ca
nnot set arguments, and does not know the
> service name; without context it cannot determine any other instance related information.  
I tried setting the "start parameters"
> from the service manager service properties screen, but did not find any way to access them
.  I was/am going to look at CPAN to see
> if anything looked interesting, but any suggestions you have are welcome.

You can modify the setting in the registry:

  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SERVICENAME

The ImagePath value contains the path to your service.  You can add
additional parameters after it.  They are available at runtime via @ARGV.

You will still need to set $PerlSvc::Name and $PerlSvc::DisplayName in the
main body of your script.  PerlSvc compiles your script and then inspects
these 2 global variables to register the service with the service control
manager.  Ther service control manager will eventually call your Startup()
function, but at that time it is way too late to provide the service name
and display name.

Cheers,
-Jan

_______________________________________________
PDK mailing list
PDK@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
David Hares
David Hares
Jan Dubois
David Hares
Jan Dubois

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved