Ubuntu init.d 腳本在啟動時未被調用

Ubuntu init.d 腳本在啟動時未被調用

我在 ubuntu 9.04 的 init.d 中有一個腳本,我已將其設定為使用 update-rc.d init_test 預設值 99 在 update-rc.d 上啟動。正確的

-rwxr-xr-x  1 root root   642 2010-10-28 16:44 init_test

mike@xxxxxxxxxx:~$ find /etc -name S99* | grep init_test
find: /etc/rc5.d/S99init_test
find: /etc/rc4.d/S99init_test
find: /etc/rc2.d/S99init_test
find: /etc/rc3.d/S99init_test

該腳本在原始程式碼和 ./ 中運行沒有問題並且行為正確。這是腳本的來源:

#!/bin/bash
### BEGIN INIT INFO
# Provides:          init test script
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

start() {
    echo "hi"
    echo "start called" >> /tmp/test.log
    return
}

stop() {
    echo "Stopping"
}

echo "Script called" >> /tmp/test.log

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    *)
        echo "Usage:  {start|stop|restart}"
        exit 1
        ;;
esac
exit $?

當機器啟動時,我在 test.log 中根本看不到「腳本呼叫」或「啟動呼叫」。有什麼明顯的我搞砸了嗎?

答案1

我知道出了什麼問題了。有一個完全不相關的腳本在啟動時被阻止,因為它要求用戶按下按鍵,這似乎會阻止所有其他啟動腳本。有沒有辦法解決類似的問題,例如記錄哪些 init.d 腳本運行?

相關內容