« 涼しくも無く暑くも無く | メイン | webalizerの検索文字列日本語解析が不発... » |

2005年9月 6日

chkconfig

 あるサービスをchkconfigで起動プロセスを操作できるように /etc/rc.d/init.d にサービスのコントロールコマンドを作ってみたけどchkconfig --addできない。こんなメッセージが出る、


service xxxxxx does not support chkconfig

そもそも、/etc/rc.d/init.d にファイルを置くだけでいいのか? と思ってちょっと調べてみたら、それだけじゃダメでした。manに書いてありましたな。

RUNLEVEL FILES
Each service which should be manageable by chkconfig needs two or more
commented lines added to its init.d script. The first line tells chk-
config what runlevels the service should be started in by default, as
well as the start and stop priority levels. If the service should not,
by default, be started in any runlevels, a - should be used in place of
the runlevels list. The second line contains a description for the
service, and may be extended across multiple lines with backslash con-
tinuation.

For example, random.init has these three lines:
# chkconfig: 2345 20 80
# description: Saves and restores system entropy pool for \
# higher quality random number generation.
This says that the random script should be started in levels 2, 3, 4,
and 5, that its start priority should be 20, and that its stop priority
should be 80. You should be able to figure out what the description
says; the \ causes the line to be continued. The extra space in front
of the line is ignored.


というわけで、/etc/rc.d/init.d に置いたファイルにコメントとして書かなきゃいけないのね。

# chkconfig: ランレベル 起動優先順位 停止優先順位

だそうです。そうそう、優先順位の数字が/etc/rc.d/rc3.dとか/rc6.dとかの数字だったのね。知らなんだー。

投稿者 ymkx : 2005年9月 6日 17:02

ブログランキング ドット ネット