running background (daemon) processes in Windows

P

Phil Tomson

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
 
E

Ernie

Phil Tomson said:
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
 
E

eg

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top