Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > running background (daemon) processes in Windows

Reply
Thread Tools

running background (daemon) processes in Windows

 
 
Phil Tomson
Guest
Posts: n/a
 
      10-21-2003
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
 
Reply With Quote
 
 
 
 
Ernie
Guest
Posts: n/a
 
      10-21-2003

"Phil Tomson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
 
eg
Guest
Posts: n/a
 
      10-22-2003
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling processes and what to "feed" other processes Marc Heiler Ruby 1 05-24-2009 05:37 PM
Problems with background processes on Windows geoff.bache@gmail.com Python 4 03-30-2009 09:16 PM
running background processes Lord Merlin ASP General 2 06-06-2004 06:54 AM
How do I: Main thread spawn child threads, which child processes...control those child processes? Jeff Rodriguez C Programming 23 12-09-2003 11:06 PM
Too many Processes running in background Kookaburra NZ Computing 11 09-24-2003 09:08 AM



Advertisments