Karger78 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks. I would like to convert my script into a service. I need it as a service due to the way web servers work and what account they use, my script will not have access to certin shares. If i run it as a service under a specific account I have all the access I need. This is what my script does. It takes input via a webpage, and pass's it to perl script which process's it. Now how would I start with my service where it's only invoked when praramaters are passed to the service?

Replies are listed 'Best First'.
Re: Perl Svc
by marto (Cardinal) on Jul 07, 2009 at 15:14 UTC

    Is this question related to windows auth, if so did none of the advice given there help?

    ikegami has already explained that the user executing the CGI scripts doesn't have sufficient privileges to access these network shares. Why not give the user executing the CGI the same privileges as the user you plan to run the service as?

    Martin

      I have no control over the web service, so in this instance I need to use windows 2003 with IIS. So when a user surfs to the web page and the perl script is invoked, it use the local system account that doesn't have priviliges to the network shares. A few other ppl I talked to said they ran into the same issue and doing it as a service worked as expected as we can tell the service what account to use.
Re: Perl Svc
by mscharrer (Hermit) on Jul 07, 2009 at 14:59 UTC
    Please give more informations about your server setup. What OS and what webserver are you using? ("Service" sounds like you are using Windows).

    The Apace Webserver has a tool called 'suexec' which allows you to run Perl and other CGI scripts under different accounts. No idea if this tool is still used in Apache 2.x or how other Webservers are doing it.

    I can not understand your last sentence. Which parameters should be passed how to the service? When it starts or when it is called? At start-up or when it is called?

Re: Perl Svc
by Jenda (Abbot) on Jul 08, 2009 at 00:04 UTC

    You could run the script via srvany.exe (you should be able to find it somewhere online), but it's better to turn the script into a real selfsufficient service. Have a look at Win32::Daemon and Win32::Daemon::Simple.

    Of course you have to communicate somehow with the service, you can't start it from the web page.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.