Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: win32::Daemon (stupid) questions

by blm (Hermit)
on Oct 15, 2002 at 12:44 UTC ( [id://205357]=note: print w/replies, xml ) Need Help??


in reply to win32::Daemon (stupid) questions

In the examples the functionality to "Create a Service" is in a different script but you could have that in the same script. You could put the install routine in a sub that only runs when a certian parameter is added eg --install. I have seen binary services written in C that implement things this way. IMHO the install routine simply adds the appropriate registry settings so the Service Control Manager can find the perl interpreter and give it the first parameter which is the full path of the perl script. The Service Control Manager is then responsible for starting, restarting and stopping your service.

AFAIK the "Not in timely fashion" error that you may see when getting the Service Control Manager to start the service is because the script did not notify the Service Control Manager of successful start up before a timeout.

--blm--

Replies are listed 'Best First'.
Re: Re: win32::Daemon (stupid) questions
by AcidHawk (Vicar) on Oct 16, 2002 at 08:01 UTC

    AFAIK the "Not in timely fashion" error that you may see when getting the Service Control Manager to start the service is because the script did not notify the Service Control Manager of successful start up before a timeout.

    I also see this when I have errors in my script. But of course I test them before I load them as a service..;) well not always... hence that error message.

    What I think you will need is the following

    } elsif( SERVICE_RUNNING == $State ) { # The service is running as normal... system('net send 127.0.0.1 Hello'); sleep 5; } else { # We have some unknown state... # reset it back to what we last knew the state to be... Win32::Daemon::State("$PrevState"); sleep( $timeout ); }

    -----
    Of all the things I've lost in my life, its my mind I miss the most.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-19 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found