Dupx
Dupx is a simple *nix utility to redirect standard output/input/error of an already running process.
Motivation
I've often found myself in a situation where a process I started on a remote system via SSH takes much
longer than I had anticipated. I need to break the SSH connection, but if I do so, the process will die
if it tries to write something on stdout/error of a broken pipe. I wish I could suspend the process with
^Z and then do a
bg %1 >/tmp/stdout 2>/tmp/stderr
Unfortunately this will not work (in shells I know).
Output redirection of a running process
If you're familiar with dup(2) *nix system call, you know that if you issue it from the process space
to an open file, you can remap any file descriptor to a new file and all subsequent calls to read/write(2)
will read/write from/to the file. Thus the simple idea behind dupx is to use gdb to attach to the
process and then do a dup(2) call on its file descriptors.
Implementation
Dupx is currently implemented as a simple shell script that drives
GDB.
Compatibility
Dupx has been tested on Fedora systems.
Files and downloads
Last Modified: Mon Aug 16 15:46:00 PDT 2010