running background (daemon) processes in Windows

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default running background (daemon) processes in Windows

    In Unix I can start a 'deamon' (background) process like:

    ruby -e 'fork do system("something") end'

    Or by putting the fork directly into my script:

    fork do
    #...do stuff...
    end

    That way if I log out of a shell session, for example, my process is still
    running in the background.

    But fork doesn't work under Windows (without cygwin) - is there a way to
    do something similar under Windows?

    Phil
    Phil Tomson Guest

  2. Similar Questions and Discussions

    1. Execute all processes in the background from bash.
      I was wondering if it's possible to prepend "time" and append "&" to all commands that I execute in bash. For example I'd like $ mozilla to...
    2. running processes from a service
      hi everyone i am trying to write a program that runs a process when invoked (a program that reads data from a server and writes the output as XML...
    3. Long-running daemon acquiring giant memory footprint
      I have written a long-running daemon in ruby to handle dynamic DNS updates. I have just recently moved it from ruby 1.6 to ruby 1.8 and updated all...
    4. Background processes inside the database.
      I am looking for a way to have a session spawn a background process and release. The user needs to be able to start a job which could conceivably...
    5. Oracle background processes
      gotta_know wrote: Not if you go through the trouble to make it work. Though anything you have written that deals with file permissions, etc....
  3. #2

    Default Re: running background (daemon) processes in Windows


    "Phil Tomson" <ptkwt@aracnet.com> wrote in message
    news:bn3v5g02hs@enews2.newsguy.com...
    > In Unix I can start a 'deamon' (background) process like:
    >
    > ruby -e 'fork do system("something") end'
    >
    > Or by putting the fork directly into my script:
    >
    > fork do
    > #...do stuff...
    > end
    >
    > That way if I log out of a shell session, for example, my process is still
    > running in the background.
    >
    > But fork doesn't work under Windows (without cygwin) - is there a way to
    > do something similar under Windows?
    >
    > Phil
    You can use the start commad from the command line. eg.

    start "Messenger Object on 9500" /DD:\pubsub ruby messenger.rb

    This will open up a new dos window with the program running

    If you want it in the background rename you script to scriptname.rbw eg.

    start "Messenger Object on 9500" /DD:\pubsub ruby messenger.rbw

    This will start the process in the background.

    Ernie


    Ernie Guest

  4. #3

    Default Re: running background (daemon) processes in Windows

    I'm not a unix guru, but I thought that a daemon process was more akin
    to running as a "service" under windows.

    If so, under windows there is a srvany.exe program on the windows 2000
    resource kit that will enable you to running programs as services.

    Alternatively, you can use a product called Firedaemon
    ([url]http://www.firedaemon.com/[/url]) to help.

    E.

    eg Guest

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139