running background (daemon) processes in Windows

Discussion in 'Ruby' started by Phil Tomson, Oct 21, 2003.

  1. Phil Tomson

    Phil Tomson Guest

    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, Oct 21, 2003
    #1
    1. Advertising

  2. Phil Tomson

    Ernie Guest

    "Phil Tomson" <> wrote in message
    news:...
    > 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, Oct 21, 2003
    #2
    1. Advertising

  3. Phil Tomson

    eg Guest

    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
    (http://www.firedaemon.com/) to help.

    E.
    eg, Oct 22, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scottman

    Daemon Server, Forking, Defunct Processes

    Scottman, Sep 11, 2008, in forum: C Programming
    Replies:
    2
    Views:
    946
    CBFalconer
    Sep 11, 2008
  2. Jean-Paul Calderone
    Replies:
    0
    Views:
    455
    Jean-Paul Calderone
    Mar 20, 2009
  3. Floris Bruynooghe
    Replies:
    1
    Views:
    450
    Floris Bruynooghe
    Mar 24, 2009
  4. Lord Merlin

    running background processes

    Lord Merlin, Jun 5, 2004, in forum: ASP General
    Replies:
    2
    Views:
    170
    Lord Merlin
    Jun 6, 2004
  5. Daemon Win32::Daemon;

    , Sep 7, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    251
Loading...

Share This Page