[Reprint] reptyr, the program is running into a new terminal

HTTPS: // www.helplib.com/GitHub/article_45241 

. Learn about

very depressed and there is no binaries arm64 Godson platform.

 


 

reptyr source code download

  • Go to the URL:
    git://www.github.com/nelhage/reptyr.git
  • Git Clone code to local:
    git clone http://www.github.com/nelhage/reptyr
  • Subversion code to local:
    $ svn co --depth empty http://www.github.com/nelhage/reptyr
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
 
reptyr - "ptying" tool program.

reptyr is a conventional operation for acquiring program and the new terminal is attached to its utility. By ssh start the process of a long-running, but must leave, do not break it? Simply start a screen, use reptyr grab it, then kill ssh session and head on home.

usage

 
reptyr PID



"Reptyr PID grab the acquisition process with id PID, and it's attached to the current terminal.

After an additional, new process from the terminal input and writes to the new terminal, including ^ C and ^ Z. (Unfortunately, if your background, you still need to run in the old terminal "bg" or "fg". Without repair shell, it may be impossible to fix a reasonable manner

Typical Usage Pattern

  • Start a long-running process, such as top
  • Background processing using ctrl z
  • Recovery process in the background: bg
  • Use  jobs -l the display background jobs are running, which should look like this:
    • [1]+ 4711 Stopped (signal) top
    • jobs -l In the -l sure you will get PID)
  • Disown use  disown top delete jobs from the current parent process. After this, jobs the task is no longer displayed, but  ps -a will.
  • Start your terminal multiplexer, such as tmux
  • Reattached to the backgrounded process: reptyr 4711
  • A terminal multiplexer separator (eg. Ctrl-off and ssh
  • Reconnect ssh, connect to your multiplexer (for example.  tmux attach ), Happy!

But wait this is not screenify "?

Now there is one called "screenify" a shell script to internet, now use gdb to (expected) to do the same work in nearly 10 years. The difference is that reptyr work very well.

If you use screenify additional "small", it will still get the input from the old terminal. If you use screenify attach a ncurses program and adjust the window size, the program will not notice. If you use screenify additional processes, the new terminal ^ C will not work.

My reptyr solve all of these problems, and is the only such tool I know of. For more details on how to accomplish this task, please see below.

port

reptyr support for Linux and FreeBSD. Not all features are available on FreeBSD. (Especially FreeBSD is not currently supported  reptyr -T.

For more information on the terminal and system call level ioctl (), the reptyr use of target and control ptrace attached to it, and therefore is highly dependent on the system call API. Technically, other operating systems may be feasible, but requires low-level knowledge of the relevant platform and may require significant refactors.

reptyr work on i386, x86_64 and ARM. It's his to port infrastructure should be simple, in most cases, such as adding a file in to ptrace.c. Add clause.

On Maverick ptrace_scope

reptyr It depends on the  ptrace system call attached to a remote program. And later on Ubuntu, for security reasons, this ability is disabled. You can temporarily enable it by doing the following


# echo 0>/proc/sys/kernel/yama/ptrace_scope

As root, or by editing the file / etc / sysctl. D / 10-ptrace. conf, also contains more information about the complete set here.

reptyr - the

As an additional feature, if the run "reptyr -l", reptyr will create a new pseudo-terminal to the end, and outputs it to the output.

If the gdb debugger, then can be passed to the NAME "Setting inferior pty". Because there is no existing program heard the rtc, which better than existing terminal shell of delivery.

: How does it work ?

The main thing to do is reptyr it actually changes the control terminal process you are connecting. I wrote a blog post explaining the content involved.

pronunciation

I pronounced the same as "repeaters," but because it is easy to clear, "re-pty-er" is also acceptable.

CREDITS

reptyr Elhage by Nelson  [email protected] company write.  There is a problem or Bug reports please contact him.

Email address

http://github.com/nelhage/reptyr

 

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/11849911.html