当我在通过笔记本电脑linux
连接到的远程盒子中运行以下命令时,我得到以下信息:windows 7
VNC
[subhrcho@slc04lyo ~]$ ps -ef|grep vnc
subhrcho 20113 19804 0 21:40 pts/8 00:00:00 grep vnc
subhrcho 27486 1 0 Jan28 ? 00:05:35 Xvnc :1 -desktop slc04lyo:1 (subhrcho) -httpd /usr/share/vnc/classes -auth /home/subhrcho/.Xauthority -geometry 1680x1050 -depth 16 -rfbwait 30000 -rfbauth /home/subhrcho/.vnc/passwd -rfbport 5901 -pn
subhrcho 27493 1 0 Jan28 ? 00:00:00 vncconfig -iconic
Run Code Online (Sandbox Code Playgroud)
我怎样才能优雅地终止这个会话?我知道kill -9 <pid>
会这样做,但我认为这是一种强有力的清理,可能会导致文件损坏。
PS:我也从这个来源阅读以使用 vncserver 中的 kill 选项,但不确定如何找出 display#。
Dan*_*son 35
正如您所注意到的,来自man vncserver
:
-kill :display#
This kills a VNC desktop previously started with vncserver. It does
this by killing the Xvnc process, whose process ID is stored in the
file "$HOME/.vnc/host:display#.pid". It actually ignores anything
preceding a ":" in its argument. This can be useful so you can write
"vncserver -kill $DISPLAY", for example at the end of your xstartup
file after a particular application exits.
Run Code Online (Sandbox Code Playgroud)
如果没有手动(和不同地)设置,则显示器编号连接到显示器的端口号,其中
Display number = (Port number) ? 5900
Run Code Online (Sandbox Code Playgroud)
例如端口 5901 ?显示:1。此信息可以在man Xvnc
(vncserver
只是一个调用此工具的包装脚本)中找到,它说:
-rfbport port
Specifies the TCP port on which Xvnc listens for connections from
viewers (the protocol used in VNC is called RFB - "remote
framebuffer"). The default is 5900 plus the display number.
Run Code Online (Sandbox Code Playgroud)
如果您不知道该号码(但无论如何您都需要知道它是否要连接到服务器),您可以检查例如ps ax | grep vnc
信息。如果我在本地这样做,我会看到流程
25697 ? S 55:38 Xvnc4 :1 [...]
[...]
30481 ? S 17:57 Xvnc4 :2 [...]
Run Code Online (Sandbox Code Playgroud)
因此我知道它们分别代表带有显示编号:1
和的VNC 服务器:2
,并且可以被杀死
vncserver -kill :1
vncserver -kill :2
Run Code Online (Sandbox Code Playgroud)
在您的情况下,您会看到显示编号:1
适用于ps
输出中列出的服务器。
归档时间: |
|
查看次数: |
286608 次 |
最近记录: |