我遇到了一个问题,即尝试使用matplotlib导入远程活动IPython会话(通过Tmux),然后注销SSH挂起。我必须要用Crtl-C来杀死这个过程。当我重新连接回机器时,tmux进程就消失了。
示例IPython:
~$ ssh-desk # ssh into remote machine
~$ tmux
~$ ipython
In [1]: import matplotlib.pyplot as plt
Crtl-b Crtl-b d
[detached (from session 0)]
~$ tmux ls
0: 1 windows (created Wed May 2 16:52:58 2018) [78x38]
~$ exit
logout
(process hangs here)
Ctrl-c
~$ ssh-desk
~$ tmux ls
no server running on /tmp/tmux-1000/default
关于X11会话被终止,我确实收到了一次错误。我想这是因为我正在使用ssh -Y将X11转发为图形。
The X11 connection broke (error 1). Did the X11 server die?
有没有办法在IPython / Python中运行matplotlib并分离tmux会话并成功注销?
我使用的是Linux Mint 18.3(本地和远程计算机),IPython 6.3.1
UPDATE 我用谷歌搜索了每个可能的解决方案,用X11转发分离tmux会话,无法让它工作,包括在.bashrc文件中放入一些DISPLAY代码。我也尝试过使用xpra,但是出现了一个无法找到模块重命令的错误。
答案 0 :(得分:0)
您可以随时回退到ssh转义序列:
sequence | description
-------- | -----------
~. | terminate connection (and any multiplexed sessions)
~B | send a BREAK to the remote system
~C | open a command line
~R | request rekey
~V/v | decrease/increase verbosity (LogLevel)
~^Z | suspend ssh
~# | list forwarded connections
~& | background ssh (when waiting for connections to terminate)
~? | this message
~~ | send the escape character by typing it twice
一旦你在tmux
内,如果你只是想终止你的ssh连接,输入例如:
~.
然后你可以再次ssh到服务器并执行:tmux attach