Is it possible to "call" a background process output to be shown in the terminal?
Example: cron starts apt-get to update the system and I want to see the output of apt-get
Is it possible to "call" a background process output to be shown in the terminal?
Example: cron starts apt-get to update the system and I want to see the output of apt-get
Not really. There are tools that can detach a process from its output file and attach it to the current terminal — see How can I disown a running process and associate it to a new screen shell?. However:
ptrace
) and modify the execution of the program in an underhanded way. This can crash some programs.The output of a cron job will be logged somewhere: either the script in the crontab redirects the output to a file, or cron will send the output to the administrator by email. Check the crontab entry to see where the output goes.
On Linux, you can check where the output of a process goes by looking at its file descriptors in /proc/PID/fd/
. File descriptor 1 is standard output and 2 is standard error.
I don't think that is possible. That would assume the process knows how to handle this situation and would reopen stdin/stdout/stderr.