Este é exatamente o caso man 1 reptyr
menciona explicitamente:
reptyr
is a utility for taking an existing running program and attaching it to a new terminal. Started a long-running process over ssh, but have to leave and don't want to interrupt it? Just start ascreen
, usereptyr
to grab it, and then kill the ssh session and head on home.
Não perca esta nota:
reptyr
depends on theptrace(2)
system call to attach to the remote program. On Ubuntu Maverick and higher, this ability is disabled by default for security reasons. You can enable it temporarily by doingecho 0 > /proc/sys/kernel/yama/ptrace_scope
as root, or permanently by editing the file
/etc/sysctl.d/10-ptrace.conf
, which also contains more information about this setting.
Observe também que reptyr
apenas anexa um processo a outro terminal. Isso não significa que o processo se torne um filho do novo shell.
O uso básico é simples:
reptyr PID
onde PID
é o PID do processo que você deseja anexar a um novo terminal.