linux - `nohup`ing an already-running process by PID (akin to AIX nohup -p) -


i have situation i'm not able run nohup -p <processid> in linux rhel 6.6 box says option not supported. read manpage , in linux had --help , --version options in linux.

is there other alternative nohup -p, allow already-running process survive exit of running terminal?

part of easy: remove job shell's process table, can use disown.

the part that's not easy redirecting stdout , stderr away tty. that, can use gdb take control of process , tell replace stdin, stdout , stderr (note you'll need sure done on other subprocesses or threads likewise need survive exit operation):

# instance of /path/to/program pid 1234  # note intended transcript of content typed @ prompt -- isn't # working shell script, since commands after "gdb" run *by gdb*, not # shell.  gdb /path/to/program attach 1234 p dup2(open("/dev/null", 1), 0) p dup2(open("stdout-file", 1), 1) p dup2(open("stderr-file", 1), 2) detach quit 

this has been automated tool called dupx.


Comments