我想在我的桌面上运行x11vnc(或其他VNC服务器),但是我找不到在任何用户登录之前启动它的方法。在我使用原始的Ubuntu 10.10时,Vino默认就可以实现这一点。然而,我现在在Xubuntu中找不到这样的方法。
/etc/init.d/vncserver
中。最简单的方法是将其复制到剪贴板中,在终端中运行sudo -i && cat > /etc/init.d/vncserver && exit
,粘贴进去,然后按下Ctrl-D。确保将USER变量更改为您希望VNC服务器在其中运行的用户。#!/bin/sh -e
### BEGIN INIT INFO
# Provides: vncserver
# Required-Start: networking
# Default-Start: 3 4 5
# Default-Stop: 0 6
### END INIT INFO
PATH="$PATH:/usr/X11R6/bin/"
# The Username:Group that will run VNC
export USER="mythtv"
#${RUNAS}
# The display that VNC will use
DISPLAY="1"
# Color depth (between 8 and 32)
DEPTH="16"
# The Desktop geometry to use.
#GEOMETRY="<WIDTH>x<HEIGHT>"
#GEOMETRY="800x600"
GEOMETRY="1024x768"
#GEOMETRY="1280x1024"
# The name that the VNC Desktop will have.
NAME="my-vnc-server"
OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
. /lib/lsb/init-functions
case "$1" in
start)
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;
stop)
log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;
restart)
$0 stop
$0 start
;;
esac
exit 0
sudo chmod +x /etc/init.d/vncserver
将脚本设置为可执行。sudo update-rc.d vncserver defaults
。这将在vncserver脚本中添加适当的符号链接,以便在适当的时间发送启动和停止命令。sudo update-rc.d vncserver 99
。sudo /etc/init.d/vncserver start
。vino-preferences
/usr/lib/vino/vino-server
更新:
试试这个:
在启动时在Ubuntu上启动VNC服务器
http://www.abdevelopment.ca/blog/start-vnc-server-ubuntu-boot
sudo update-rc.d vncserver defaults 99
,我想。 - Christoph