I am trying to write a program , which does a fork
and exec
a child process and executes it in the back ground .
One approach I would see is to redirect the output to /dev/NULL
file and come back to my main program . Any other ideas ?
I am trying to write a program , which does a fork
and exec
a child process and executes it in the back ground .
One approach I would see is to redirect the output to /dev/NULL
file and come back to my main program . Any other ideas ?
After a process is started, shell has no more control on process file descriptors so you can not silence it by a shell command i.e. terminal has its stdin, stdout and stderr bound to the terminal and you cannot do anything about it without re-gaining control over that terminal.
There is a tool called retty
how you can use it can be seen at this link retty this tool is used to attach processes running on terminals
Beside you can also use the built in disown
command to disown the process which will prevent from sending a SIGHUP
signal to the program when the shell exits
This link can be helpful Link to a similar problem