运行 update-rc.d ccpd defaults 99 后 Ubuntu 14.04 无法关闭

运行 update-rc.d ccpd defaults 99 后 Ubuntu 14.04 无法关闭

我按照 Ubuntu 问答线程上的 Canon LBP2900 打印机安装程序进行操作。最后打印机开始工作了。一切都很顺利,直到我在终端中运行 update-rc.d ccpd defaults 99。我的电脑无法关机,它会注销并挂在 Ubuntu 徽标上(背景为蓝色、粉红色、红色或绿色)。我该如何恢复或解决关机重启问题。

答案1

UBUNTU 在关机(或重启)时挂起是由脚本 /etc/init.d/ccdp 引起的。第一个 if 语句查找正在运行的 cups。但在关机的情况下,cups 已经终止,并且 if 语句永远不会成功!将此语句移到开始部分或改用 Radu Cotescu 为 UBUNTU 编写的略微修改的脚本。(https://radu.cotescu.com/how-to-install-canon-lbp-printers-in-ubuntu/)就我而言,它运行良好。

#!/bin/sh
# startup script for Canon Printer Daemon for CUPS (ccpd)
# Modified for Debian GNU/Linux by Radu Cotescu
# Slightly modified for UBUNTU with Upstart by Gerhard Kraus
### BEGIN INIT INFO
# Provides:       ccpd
# Required-Start: 
# Required-Stop:
# Default-Start:  2 3 4 5
# Default-Stop:   1
# Short-Description: Canon Printer Daemon for CUPS
### END INIT INFO

DAEMON=/usr/sbin/ccpd
LOCKFILE=/var/lock/subsys/ccpd
NAME=ccpd
DESC="Canon Printer Daemon for CUPS"

test -f $DAEMON || exit 0

. /lib/lsb/init-functions

export PATH=$PATH:/usr/local/sbin:/usr/local/bin

ccpd_start ()
{
    if [ `ps awx | grep cupsd | grep -v grep | wc -l` -eq 0 ]; then
        while [ `ps awx | grep cupsd | grep -v grep | wc -l` -eq 0 ]
        do
            sleep 3
        done
        sleep 5
    fi

    log_begin_msg "Starting $DESC: $NAME"
    start-stop-daemon --start --quiet --oknodo --exec ${DAEMON}
    log_end_msg $?
}

ccpd_stop ()
{
    log_begin_msg "Stopping $DESC: $NAME"
    start-stop-daemon --stop --quiet --oknodo --signal 15 --exec ${DAEMON}
    log_end_msg $?
}


case $1 in

    start)    
        ccpd_start
        ;;

    stop)
        ccpd_stop
        ;;

    status)
        echo "$DESC: $NAME:" `pidof $NAME`
        ;;

    restart)
        log_begin_msg "Restarting $DESC: $NAME"
        ccpd_stop
        sleep 2
        ccpd_start
        log_end_msg $?
        ;;

    *)
        echo "Usage: ccpd {start|stop|restart|status}"
        exit 1
        ;;
esac
exit 0

相关内容