[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

running background (daemon) processes in Windows

ptkwt

10/21/2003 6:50:00 PM

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
2 Answers

Ernie

10/21/2003 10:41:00 PM

0


"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


eg

10/22/2003 6:59:00 AM

0

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.fired...) to help.

E.