-
-
Save jim3ma/239d6257f715d6ea91f630426ea01021 to your computer and use it in GitHub Desktop.
How to redirect a running process output to a file and log out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctrl-z | |
bg | |
touch /tmp/stdout | |
touch /tmp/stderr | |
gdb -p $! | |
# In GDB | |
p dup2(open("/tmp/stdout", 1), 1) | |
p dup2(open("/tmp/stderr", 1), 2) | |
detach | |
quit | |
# Back in shell | |
disown | |
logout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment