init.d脚本不工作?

我很早以前从这里复制了一个init脚本, 在启动时自动启动我的tightvncserver。 它在当时是完美的。 从那以后,我重新格式化了我的电脑,现在我的脚本不会自动启动。 如果我打电话/etc/init.d/tightvncserver通过SSH手动启动,那么我的VNC服务器启动,因为它应该…任何想法是怎么回事?

这是我的脚本

#!/bin/sh # /etc/init.d/tightvncserver # http://www.penguintutor.com/linux/tightvnc #Set the VNCUSER variable to the name of the user to start tightvncserver VNCUSER='jake' case "$1" in start) su $VNCUSER -c '/usr/bin/tightvncserver :2' echo "Starting TightVNC server for $VNCUSER " ;; stop) pkill Xtightvnc echo "Tightvncserver stopped" ;; *) echo "Usage: /etc/init.d/tightvncserver {start|stop}" exit 1 ;; esac exit 0 

如果您的初始化脚本在rc * .d目录中没有符号链接,请运行以下命令来创build它们:

 update-rc.d tightvncserver defaults 

检查您的脚本是否在运行级别中启用:

方法1:

ls /etc/rc?.d/

方法2:

 apt-get install chkconfig chkconfig --list