Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: (tye)Re: Running Perl code from a Windows service

by HamNRye (Monk)
on Sep 19, 2001 at 02:46 UTC ( #113230=note: print w/ replies, xml ) Need Help??


in reply to (tye)Re: Running Perl code from a Windows service
in thread Running Perl code from a Windows service

A few things: Services can interact with the command line or the network, not both. Services will fail if they must do both.

Use the srvany.exe to run your perl script as a service.

~Hammy
Ommmmm.....


Comment on Re: (tye)Re: Running Perl code from a Windows service
Re: Re: (tye)Re: Running Perl code from a Windows service
by $code or die (Deacon) on Sep 19, 2001 at 03:14 UTC
    Services can interact with the command line or the network
    I think you mean desktop as opposed to command line.

    By default, the service will probably run as LocalSystem - which has the option of accessing the desktop, but can't access the network. If you run it as a domain\workgroup user, it will be able to access the network and it will be able to spawn processes, but they won't be visible to the interactive user.

    Finally, I prefer Win32::Daemon to srvany.exe - It's a bit more work, but so much more powerful.

    update: No. I don't have shares in Dave Roth!

    _________________________________________
    Simon Flack ($code or die)
    $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
    =~y'_"' ';eval"die";print $_,lc substr$@,0,3;
      A service should not need to access the desktop. It can, BTW, throw up a message box for an error and it will be visible to any desktop that's current. There's a special flag in MessageBox for this.

      But the service will normally work behind the scenes. Another program, running as a normal program in the current interactive user's account, can interact with the user and communicate with the service. That's the model MS describes.

        You are probably right, I haven't tried MessageBox in a service.

        I am slightly confused about the model you describe. Are you saying that the service should spawn a process in the context of the current logged on user so the user can interact with it? I am not disagreeing with you here, just seeking clarification. It sounds complicated - what happens when the user logs off? Do you kill the process and spawn a new one with the new logged on user?

        Personally, I agree that a service shouldn't need access to the desktop. All the services I have written have been completely in the background, and if I've needed to interact with it, I use a client with sockets or something. But your model sounds a bit confusing. Unless we're talking about the same thing. What do you mean by "Another program, running as a normal program "

        Simon Flack ($code or die)
        $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
        =~y'_"' ';eval"die";print $_,lc substr$@,0,3;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://113230]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2015-07-02 01:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (25 votes), past polls