LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 618|回复: 1

如何自动运行vncserver

[复制链接]
发表于 2011-2-24 18:18:20 | 显示全部楼层 |阅读模式
dbian  gdm lxde
可以自动进入用户,如何使vncserver 自动运行?搜过无数帖子并无效果


多谢楼下!
发表于 2011-2-25 11:35:22 | 显示全部楼层
这个是我网上搜得,保存后放到/etc/init.d/下,然后用rcconf把这个选上就可以了。


#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          vncserver
# Required-Start:    networking
# Default-Start:     S
# Default-Stop:      0 6
### END INIT INFO


PATH="$PATH:/usr/X11R6/bin/"

# The Username:Group that will run VNC
export USER="用户名"
#${RUNAS}

# The display that VNC will use
DISPLAY="2"

# 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
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表