Mostly, if I closed the current terminal, the sub_process are also closed. Of course, if I use suspend the process and use `bg JobID wakeup it, the process is divided with the terminal and run in background. So what the relationship between the current terminal and the process that is triggered by the terminal. Are they father-son or brothers?
Possible Duplicate:
How to suspend and bring a background process to foreground
I have kind of an odd problem which I haven't encountered before. Here's what I did:
I started an application with ./myApp.
No command line arguments, no & to make it run in background.
Unfortunately, my system froze at some point.
2 questions:
1) Is there any Linux/Posix API to know if a process has been invoked as a background process?
linux> myprogram &
Can the code for myprogram detect that it has been invoked to run in the background (via &) ?
2) Is there any Linux/Posix API to make a process run in the background even if it has been started as a foreground process? I.E.
I have a program that forks a process, and determine if child process should run in foreground and background. I call the signal function to handle the child signal before forking, to make sure dead child process will not turn into zombies.
Introduction
If you start a process on a terminal, being it local or a remote (ssh) terminal, you normally loose the control of the terminal while the process is running, then if you want to recover that control, you have some options.
Cancel the process
By pressing CTRL+C you can stop a running process, and recover the control of your terminal, this will tell to the running application to stop an
I currently have a background process on my unix server that's running hours longer than it should be.
I can't remember the command to allow me to see the output of a background process. I'll remember to bookmark this answer!
I am trying to understand the situation why .xsession file expects the last process to be in foreground otherwise it is supposed to stop X11 session.
I have a small stand-alone script.
I'm pretty sure I had the answer to this months ago and have misplaced it. Needless to say I will bookmark it this time.
I have a background process that's been running way longer than usual. It doesn't output anything to a file, so I can't 'tail -f' it. Is there a command that will enable me to see the output the process would be sending to the screen if it was not in the background?
Thanks.
I've started a long running and machine hog process. I've hit CTRL-Z to stop it. I've then put it in the background with bg. Oops, I should have restarted with fg so that I could easily stop and start it again. What is the easiest way to stop a process that was just put into the background?