attach a process to init
Hello everybody,
When i open a terminal and run a program like say: $programname The program runs in foreground. When I want to put it to background I can invoke it as: $programname & In the above case ,program will still be the child of bash. If i close the terminal then the process terminates. Is it possible to attach this process to init so that even if I close the terminal the program continues to run? |
The problem is caused because the program you run has the terminal set to the terminal of the parent shell. When that terminal is closed, SIGHUP (the hang-up signal) is sent to all processes which are attached to the terminal, and presumably your program chooses the default action for this signal, which is to terminate.
There are several solutions. I list them here is order of easy of implementation/use, easiest first:
|
All times are GMT -5. The time now is 10:02 PM. |