Linux上VNC 启动和关闭常见问题

0, 重设密码

[[email protected] ~]# vncpasswd
          Password:
          Verify:
        [[email protected] ~]#

1,启动和kill  vncserver

[[email protected] ~]# vncserver :1
  New ‘yqrh5u2:1 (root)‘ desktop is yqrh5u2:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/yqrh5u2:1.log
[[email protected] ~]# vncserver :2
New ‘yqrh5u2:2 (root)‘ desktop is yqrh5u2:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/yqrh5u2:2.log
[[email protected] ~]# ps -ef|grep -i vnc
root    
12572     1  0 02:23 pts/2    00:00:00 Xvnc :1 -desktop yqrh5u2:1
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport
5901 -pn
root     12580     1  0 02:23 pts/2    00:00:00 vncconfig -iconic
root    
12617     1  0 02:23 pts/2    00:00:00 Xvnc :2 -desktop yqrh5u2:2
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport
5902 -pn
root     12625     1  0 02:23 pts/2    00:00:00 vncconfig -iconic
root     12735 12536  0 02:24 pts/2    00:00:00 grep -i vnc

手动kill :1, :1的pid是12572,并验证:1确实已经被kill

[[email protected] ~]# kill -9 12572
[[email protected] ~]# ps -ef|grep -i vnc
root    
12617     1  0 02:23 pts/2    00:00:00 Xvnc :2 -desktop yqrh5u2:2
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport
5902 -pn
root     12625     1  0 02:23 pts/2    00:00:00 vncconfig -iconic
root     12779 12536  0 02:25 pts/2    00:00:00 grep -i vnc

通过vncserver kill :1,:2,这是最好的方法,推荐使用

[[email protected] ~]# vncserver -kill :1
Killing Xvnc process ID 12572
kill 12572: No such process
[[email protected] ~]# vncserver -kill :2
Killing Xvnc process ID 12617
[[email protected] ~]# ls /root/.vnc/
passwd  xstartup  yqrh5u2:1.log  yqrh5u2:2.log

2,重新启动一个手动kill的vncserver,

因为是手动自己删除的,所以要再删除一下被lock的文件,才可以重新启动,如图所示

[[email protected] ~]# vncserver
Warning: yqrh5u2:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server yqrh5u2:1
New ‘yqrh5u2:2 (root)‘ desktop is yqrh5u2:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/yqrh5u2:2.log
[[email protected] ~]# vncserver :1
Warning: yqrh5u2:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server yqrh5u2:1
A VNC server is already running as :1
[[email protected] ~]# rm -f  /tmp/.X1-lock
[[email protected] ~]# vncserver :1
Warning: yqrh5u2:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server yqrh5u2:1
A VNC server is already running as :1
[[email protected] ~]# ps -ef|grep -i vnc
root    
12971     1  0 02:32 pts/2    00:00:00 Xvnc :2 -desktop yqrh5u2:2
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport
5902 -pn
root     12979     1  0 02:32 pts/2    00:00:00 vncconfig -iconic
root     13047 12536  0 02:33 pts/2    00:00:00 grep -i vnc
[[email protected] ~]# rm -f /tmp/.X11-unix/X1
[[email protected] ~]# vncserver :1
New ‘yqrh5u2:1 (root)‘ desktop is yqrh5u2:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/yqrh5u2:1.log
[[email protected] ~]# ps -ef|grep -i vnc
root    
12971     1  0 02:32 pts/2    00:00:00 Xvnc :2 -desktop yqrh5u2:2
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport
5902 -pn
root     12979     1  0 02:32 pts/2    00:00:00 vncconfig -iconic
root    
13071     1  1 02:33 pts/2    00:00:00 Xvnc :1 -desktop yqrh5u2:1
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport
5901 -pn
root     13092     1  0 02:33 pts/2    00:00:00 vncconfig -iconic
root     13123 12536  0 02:34 pts/2    00:00:00 grep -i vnc
[[email protected] ~]#

时间: 2024-10-19 13:24:06

Linux上VNC 启动和关闭常见问题的相关文章

解决SSH窗口关闭,linux上的应用也关闭

最近在应用linux上的服务的时候发现一个问题 使用SSH远程连接启动的应用在SSH关闭的时候也死掉了,网上查了一下原因 大致是说SSH在关闭的时候会发送一个终止的指令给应用,然后就停了 简要的解决办法如下: 在执行命令的时候加上前缀后缀 原本命令  ./run 现命令:nohup ./run & 但是这样会把控制台输出到nohup.out文件 详情参考这位博友的文章: 解决Linux关闭终端(关闭SSH等)后运行的程序或者服务自动停止[后台运行程序]

Linux 下 MySQL 启动与关闭 说明

转自:http://www.cnblogs.com/springside-example/archive/2011/11/29/2529604.html 一.启动 1.1  MySQL 进程 可以用ps 命令查看进程: [[email protected]2 ~]# ps -ef|grep mysql root     2161     1  0 09:38 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe--datadir=/var/lib/mysq

linux系统安装、启动和关闭tomcat

Tomcat 可充当一个完全独立的 web 服务器.Tomcat 最大优势在于 servlet 和 JSP 引擎.安装 tomcat:Sudo yum install -y tomcat-*启动 tomcat:[user@localhost ~]$ /etc/rc.d/init.d/tomcat start [user@localhost ~]$[user@localhost ~]$ /etc/rc.d/init.d/tomcat status[user@localhost ~]$ 如上所示,启

解决Linux上tomcat启动却无法访问

linux中tomcat的安装 安装tomcat前首先要安装对应的jdk并配置Java环境 下载tomcat安装包 下载路径:https://tomcat.apache.org/download-80.cgi 将tar.gz包上传包linux CRT中Alt+P可打开SFTP传输,其中常用的指令如下: lpwd:本地路径 pwd:linux上路径 lcd:cd到本地路径 cd:cd到linux路径 解压安装 解压:tar -zxvf apache-tomcat-8.5.35.tar.gz 到bi

[Linux]在终端启动程序关闭终端不退出的方法

?? 在终端启动程序关闭终端不退出的方法 普通情况下关闭终端时,那么在这个终端中启动的后台程序也会终止.要使终端关闭后,后台程序保持运行,使用这个指令: nohup 命令 & 如:nohup test.sh &

Linux下Mysql启动、关闭、重启指令

原创作品,出自 "深蓝的blog" 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任. 深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/44085635 [[email protected] ~]# rpm -qa|grep -i mysql --查询linux系统中是否安装mysql数据库 mysql-devel-5.1.66-2.el6_3.x86_64 perl-DBD-MySQL-4.013-3.

linux平台apache启动、关闭、重启的几种方式

基本的操作方法: 本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况 apahce启动命令: /usr/local/apache2/bin/apachectl start 启动 apache停止命令: /usr/local/apache2/bin/apachectl stop   停止 apache重新启动命令: /usr/local/apache2/bin/apachectl restart 重启 要在重启 Apache 服务器时不中断当前的连接,则应

Linux系统Oracle启动、关闭

Linux系统启动Oracle命令 su - oracle sqlplus /nolog conn /as sysdba startup exit lsnrctl start exit Linux系统关闭Oracle命令 su - oracle sqlplus /nolog conn /as sysdba shutdown immediate exit lsnrctl stop exit Windwos Server系统启动Oracle命令 lsnrctl start net start Ora

windows和Linux下定时启动或关闭服务

http://blog.csdn.net/clare504/article/details/17410643 1.Windows下的定时启动程序可以采用系统的计划和任务,定时启动服务可以在计划任务中添加一个启动服务的批处理程序. 例如定时启动cimserver服务,可以在用记事本写成一个批处理文件,然后在计划任务中手动添加定时执行该批处理. 批处理文件内容如下: sc stop cimserver                                       //先停止服务ping