When processes get executed in the background, for example by using systemd
to start the processes at startup, why doesn't the stdout
and stderr
still appear on the terminal when we access the terminal via SSH or serial? Where does it go exactly?
I understand that if we directly run a process from the terminal, that that process will become a child process of the terminal instance and hence, stdout
and stderr
will write to a file descriptor understood by the terminal.
However it's not understood where the stdout
and stderr
is going when a process is executed in the background not from the terminal. Thanks in advance .
open
,close
anddup
system calls. So, in my understanding it's the child that inherits the parent's files and redirects them. Of course, at this point in time, the child is still a shell, and only after redirection will itexec
the program. Perhaps we are both right.