gdb vs stdout

You know when you start a daemon and forget to redirect the outputs, but you do not want more to stop the daemon? Ok, dont worry, use the gdb!

$ gdb -p pid_here
p dup2(open("/tmp/stdout", 1), 1)
p dup2(open("/tmp/stderr", 1), 2)
detach
quit

PS: The files must be created before!

Category: Others

Tagged:

Leave a Reply