To maybe clarify a bit more about what the OP said...

The OP combined the Windows "Service installation program" and the "Service itself" into one file. This is fine although often this would be 2 separate programs. The installation option makes entries into the Windows Registry about this new service and then exits - that is all it does.

A Windows service is like a unix daemon. This is a process that runs "in the background" with no connection to a command line terminal. There are many examples of things like that. A database server would be an example.

I have verified that the installation part "works". The service is "installed" and looks normal to the Windows O/S. I can start the service with the "net start" command or from the GUI.

The issue here is how to run an external program and get its result from the Service environment? The service is not started from a command line shell and doesn't have connections to STDOUT,STDERR,STDIN. I found that I could use backticks to run the ping program and get the output of ping although I was not able to get ping to work with run() or run3().

So I found a way to get ping into the Service's log, but this is only a partial solution. This is an question about the environment that the service is running in.


In reply to Re^2: Win32::Daemon + IPC::Run redirect problem by Marshall
in thread Win32::Daemon + IPC::Run redirect problem by chris212

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.