home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.internals
- Path: sparky!uunet!stanford.edu!leland.Stanford.EDU!dayton.Stanford.EDU!lma
- From: lma@dayton.Stanford.EDU (Larry Augustin)
- Subject: Re: How can a Unix process put itself in background?
- Message-ID: <lma.716092591@dayton.Stanford.EDU>
- Sender: news@leland.Stanford.EDU (Mr News)
- Organization: DSO, Stanford University
- References: <lma.716056953@dayton.Stanford.EDU>
- Date: 10 Sep 92 02:36:31 GMT
- Lines: 30
-
- lma@dayton.Stanford.EDU (Larry Augustin) writes:
-
- >Someone stopped by my office with this question yesterday.
-
- >A user invokes a program at the shell, and interacts with the program
- >for a short time. Eventually the user selects some "quit" option of
- >the program. Before the program really quits, it wants to go off and
- >spend a minute or two checking some database files on disk. Is there
- >any way for the program to return control to the user's shell while it
- >does the background stuff? In effect, the program wants to "detach"
- >itself from stdin/stdout, return control to the shell, and continue in
- >background for a while before exiting.
-
- >The only solutions we could come up with were based on forking a child
- >to do the background part. is this the only way to do it? Is there a
- >solution that does not need a fork?
-
- I know about job control! I'm NOT asking how to use job control! I'm
- talking about writing a C program that places ITSELF in background.
- I'm not talking about the user typing ^Z.
-
- Please, no more messages telling me how to use ^Z!
-
- The consensus seems to be that it can't be done (without forking), as
- whatever shell exec'd the program will be stuck in a wait(), and could
- only continue upon death of the child (or some interaction by the
- user). There would have to be some other convention for the running
- program to tell the shell to continue.
-
- Larry
-