in reply to Re^2: Win32::Daemon service doesn't reach RUNNING state
in thread Win32::Daemon service doesn't reach RUNNING state

Explain what you mean by "a daemon"?

If you just mean a background task, that's a lot easier than creating a service--which has the daemon-like properties of running detached but is an aweful lot more besides.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
  • Comment on Re^3: Win32::Daemon service doesn't reach RUNNING state

Replies are listed 'Best First'.
Re^4: Win32::Daemon service doesn't reach RUNNING state
by zejames (Hermit) on Sep 14, 2004 at 11:42 UTC
    Yeah, I just meant "a background task"...

    I had a look at Proc::Daemon, but it does not seem to run under Windows. However, I would be very grateful if such a module existed for Windows.

    Kind regards


    --
    zejames

      Depending what it is that your actually trying to achieve, it could be as simple as:

      P:\test>start /b perl -le"open LOG, '>', 'my.log'; select LOG; $|=1; print ~~localtime while sleep 10" 1>nul 2>&1 <nul P:\test>u:tail -f my.log Tue Sep 14 12:11:10 2004 Tue Sep 14 12:11:20 2004 ^C

      The "one-liner" (here split across multiple lines to avoid wrapping) could be just about any perl script you like. It runs in the background, has it's STDIN, STOUT and STDERR redirected to the nul device and will continue to run until terminated through the task manager or other mechanism.

      Proc::Daemon does a couple of other things--changing the umask (whatever that is) etc.-- but nothing that you cannot easily do yourself.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
        In fact my problem was that I was not aware of the windows 'start' command. As I said, I'm a Windows newbie ;)

        Many thanks !


        --
        zejames
        In fact, your solution does not fully fit my needs : if I try to exit from the windows that was used to launch the 'start' command, it hangs. And if I close that windows 'by force', the perl script does not run any longer.

        So that's not a real daemon behaviour, because I do not want a window to be attached to the program.

        Any hint ?

        --
        zejames