linux + /etc/init.d에서 새 스크립트의 checkconfig 구성

linux + /etc/init.d에서 새 스크립트의 checkconfig 구성

/etc/init.d 아래에 새 스크립트를 추가하고 싶습니다 - doCopy

  /etc/init.d/copy

chkconfig에 이 스크립트를 추가하는 방법

그래서 내가 실행하면 :

chkconfig --list | grep doCopy

나는 얻을 것이다:

  doCopy          0:off   1:off   2:on    3:on    4:on    5:on    6:off

답변1

/etc/init.d/copy적어도 서비스 시작 및 중지는 지원 한다고 생각합니다 . 예를 들어:

/etc/init.d/copy start
/etc/init.d/copy stop

스크립트에 필요한 주석이 있는지 확인하십시오(checkconfig 매뉴얼 페이지 참조).

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.

그냥 실행하세요:

chkconfig --add copy

관련 정보