如何在linux新增服務

lfree發表於2007-08-14

最近要寫一個oracle啟動服務,遇到一個問題,特記錄如下:編寫好指令碼後,測試可以正常啟動與關閉,加入服務的時候出現如下提示:

chkconfig --add oracle
service oracle does not support chkconfig

google發現如下連結:

Make sure the rc script has a chkconfig-conforming header.
Citing the manual page:

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
chkconfig 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
continuation.

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.


仔細檢查我寫的oracle指令碼,發現description 我少寫一個冒號,加入後,在執行
chkconfig --add oracle

一切正常。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-83086/,如需轉載,請註明出處,否則將追究法律責任。

相關文章