background process

R

Richard J. Otter

I'm a bit confused with the differences between Unix and Window regarding
background processes. Even the term "background process" is ill-defined.

Is it possible to start a process in a command shell that continues to run
after the command shell is closed and also after the user is logged out? I
understand that I could install a service and start it, but can an ordinary
process also run? I guess one could start the process with the scheduler,
but this seems like a back-door approach.
In UNIX, I believe there are the "screen" and "nohup" utilities to
accomplish this.


Thanks for any information pointers-
Richard
 
F

Frank

Richard J. Otter <[email protected]>...

^ Is it possible to start a process in a command shell
^ that continues to run after the command shell is
^ closed ...

Yes. Create the process as detached and as a new process group and on a
separate desktop. RunProcess can help you with this:

runprocess /f:dg /x /desktop:temp cmd /c BGscript.cmd
<fpw.static.pe.net:8080/freeware/runprocess.zip>


^ ... and also after the user is logged out?

Not in the users space, which doesn't exist after the user logs out.


^ I understand that I could install a service and start
^ it, but can an ordinary process also run?

Yes. Use SRVANY.EXE from the resource kit (I think). The process must ignore
the logoff message.


Frank
 
M

Marty List

If you want the process to survive after the user logs out, I'm pretty sure
you need to launch it from a service. I think there is a way to write code
that will ignore the logout event, but if you don't have access to the
source code then the program will respond to the logout event by exiting.
 
S

Scot Wiedenfeld

Marty List said:
If you want the process to survive after the user logs out, I'm pretty sure
you need to launch it from a service. I think there is a way to write code
that will ignore the logout event, but if you don't have access to the
source code then the program will respond to the logout event by exiting.

As Frank indicated:

Use Instsrv.exe and Srvany.exe from the Windows NT/2K resource kit

or you could do the following:

Step 1 - Create a whatever.bat file with a command to run your program

Step 2 - Click on Start-->Settings-->Control Panel-->Scheduled Tasks-->Add
Scheduled Task--> Click Next -->Browse out to your whatever.bat file, select
it, click Open,-->Select the radial option to Perform this task: "When my
computer starts".--> Click Next-->enter your password & password
confirmation, click Next --> Click Finish....

Wa-Laa

Just my 2.0135 cents worth (tax included)
Scot Wiedenfeld
 

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

Top