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

Hello monks!

I've made a script using win32::daemon - it is a windows service. Now are all the variables hard-coded in the script and it works - I can start it as a windows service and it runs in background.

I want to change it to read some variables from a config file - I tried open a file or even "require", but it doesn't work - the service doesn't want to start anymore - throws "Error 1053: The service did not respond to the start or control request in a timely fashion" inmediately

Where could be the problem?

Regards,
Jan
  • Comment on win32::daemon - problem reading file in the service

Replies are listed 'Best First'.
Re: win32::daemon - problem reading file in the service (log)
by tye (Sage) on Mar 28, 2007 at 14:28 UTC

    It sounds simply like your script is dieing. Put this at the top of your script:

    BEGIN { open STDERR, ">> c:/script.log" }

    then try to start your script and look at the errors that get recorded in that file. Note that there might well be other ways to see what was written to STDERR by a Win32 service, but I don't see much point in trying to look such up since this solution is so simple.

    - tye        

      It works ...thank you very much!

      It reads the config text file without any problems now - probably the error was, that the STDERR wasn't redirected anywhere (which could be a problem with a service running in background)

      btw: what means the BEGIN{ } syntax?

      jan
Re: win32::daemon - problem reading file in the service
by BrowserUk (Patriarch) on Mar 28, 2007 at 13:15 UTC
      :) ok ..but this isn't much helpful :-P

      I don't understand, that such basic thing as include a file or read a file can cause this strange error :-/

      Anybody who experienced such problem by using win32:daemon??
        Unless you show some code you are unlikely to see more hlepful replies.

        Anno

        Unless you show some code you are unlikely to see more helpful replies.

        Anno

        Update: This is a duplicate, reap away.