LSBヘッダーが機能しない起動スクリプト(依存関係の問題?)

LSBヘッダーが機能しない起動スクリプト(依存関係の問題?)

Ubuntu 14.04.1 LTSサーバー用の起動スクリプトを作成しています。このスクリプトはRabbit MQサーバーの後に実行する必要があります。 Rabbit MQ起動スクリプトは「rabbitmq-server」を提供すると言います。したがって、この文字列を起動スクリプトヘッダーの「必須開始」リストに入れました(下記参照)。ただし、update-rcを使用してスクリプトをインストールした後、Rabbit MQスクリプトとスクリプトの両方が「S20」レベルになります。つまり、依存関係が機能しないようです。私のスクリプトも正しく起動しませんが、起動後に手動で実行すると起動します。問題を解決する方法についてのアイデアはありますか?

### BEGIN INIT INFO
# Provides: amqp_receive
# Required-Start: $local_fs $network rabbitmq-server
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Script to provide start/stop/status of the amqp_receive program
### END INIT INFO
lrwxrwxrwx 1 root root  22 Aug 17 00:29 S20amqp-receive -> ../init.d/amqp-receive
lrwxrwxrwx 1 root root  25 Aug 13 18:14 S20rabbitmq-server -> ../init.d/rabbitmq-server
lrwxrwxrwx 1 root root  15 Apr 16 18:26 S20rsync -> ../init.d/rsync
lrwxrwxrwx 1 root root  24 Apr 16 18:26 S20screen-cleanup -> ../init.d/screen-cleanup
lrwxrwxrwx 1 root root  23 Apr 16 18:26 S38open-vm-tools -> ../init.d/open-vm-tools
lrwxrwxrwx 1 root root  26 Apr 16 18:26 S45landscape-client -> ../init.d/landscape-client
lrwxrwxrwx 1 root root  19 Apr 16 18:26 S70dns-clean -> ../init.d/dns-clean
lrwxrwxrwx 1 root root  18 Apr 16 18:26 S70pppd-dns -> ../init.d/pppd-dns
lrwxrwxrwx 1 root root  21 Apr 16 18:26 S99grub-common -> ../init.d/grub-common
lrwxrwxrwx 1 root root  18 Apr 16 18:25 S99ondemand -> ../init.d/ondemand
lrwxrwxrwx 1 root root  18 Apr 16 18:25 S99rc.local -> ../init.d/rc.local

ベストアンサー1

問題は、スクリプトがアルファベット順に実行されることです(上記のように、問題はすべてで始まるということですS20)。したがって、S20amqp-receive以前に実行してくださいS20rabbitmq-server。同意します。実行に問題が発生しましたupdate-rc.d。たぶん、update-rc.d amqp-receive defaultsやり直すこともできます。

S20amqp-receive別の解決策は(手動で)名前をに変更することですS21amqp-receive。その後、このスクリプトはで始まるスクリプトの後に実行されますS20

メモ:依存関係を変更することをお勧めします。

おすすめ記事