web-dev-qa-db-ja.com

update-rc.dなしの起動時のスクリプト

私はDebianの最小限のインストールをしていて、起動時にカスタムスクリプトを開始したいだけです。

  1. 私は/ etc/init.d/myscriptにスクリプトを持っています、
  2. chmod 700を入れて、S20myscriptへのシンボリックリンクを:に作成します。

    /etc/rc2.d
    /etc/rc3.d
    /etc/rc4.d
    /etc/rc5.d
    

ただし、起動時にスクリプトはまったく起動されません。

このスクリプトをupdate-rc.d(またはinsserv...)と一緒に使用すると、機能します。

わかりませんが、このコマンドを使用せざるを得ませんか?

(いいえ、/etc/rc.localは使いたくありません)。

3

rc*.dディレクトリ内のすべてのシンボリックリンクを削除してみてください。

次に、実行してみてください。

update-rc.d -n myscript enable

ここで、-nnot-reallyを意味します

これはinsservが何をすることになっているのかをリストします:シンボリックリンクを作るそしていくつかの.depend.*ファイルを生成する

init.d/.depend.bootinit.d/.depend.start、およびinit.d/.depend.stopをご覧ください。これらのファイルも更新する必要があるかもしれませんか?手作業で変更することにした場合(ただし、update-rc.dの何が問題になっていますか?)、update-rc.dをさらに呼び出しても編集内容が混乱しないように特に注意してください。

これらのman startparファイルの使用法に関する知識を得るには、man insservおよび.depend.*を参照してください。

そして私の最後のアドバイスは:update-rc.dを使用する:)

2

/etc/rc.localに追加することの何が問題になっていますか?それが最も簡単な方法です。

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.    
#
# By default this script does nothing.
0
dfc