새로 작성한 데몬을 등록하는 방법?

marunguy의 이미지

안녕하세요.
데몬프로그램(myd)을 작성했습니다.
원하는 대로 동작하고 데몬모드로도 동작하는 것을 확인했습니다.

[root@localhost testid]# ps -lA | grep myd
1 S     0  2789     1  0  75   0 - 55597 stext  ?        00:00:00 myd

myd 를 httpd, sshd 데몬처럼 시스템시작시 자동으로 시작되는 데몬으로 등록하고 싶습니다.
검색해보기는 했지만 자세한 설명은 찾기 힘드네요.
일단, CentOS 와 같은 레드햇계열에서 chkconfig 를 사용하면 되는 것 같더군요.
myd 를 어느경로에 놓아야 되는건가요?
/etc/init.d 폴더에 myd 파일을 복사하고 chkconfig -add 하면 되나요?

chkconfig -add myd

marunguy의 이미지

myd 를 /etc/init.d/ 에 복사하고 chkconfig --add 를 해보았는데 안되네요.
chkconfig 로 데몬을 등록될려면 무엇을 더해줘야 하나요?

[root@localhost ~]# /etc/init.d/myd start
[root@localhost ~]# ps -lA | grep myd
1 S     0  3048     1  1  75   0 - 55607 stext  ?        00:00:00 myd
[root@localhost ~]# /etc/init.d/myd stop
[root@localhost ~]# ps -lA | grep myd
[root@localhost ~]# /etc/init.d/myd restart
[root@localhost ~]# ps -lA | grep myd
1 S     0  3105     1 12  75   0 - 55608 stext  ?        00:00:00 myd
[root@localhost ~]# /etc/init.d/myd stop
[root@localhost ~]# chkconfig --add myd
myd 서비스는 chkconfig 를 지원하지 않습니다
pogusm의 이미지

아마
# vim /etc/rc.d/rc.local 파일을 열어서 제일 마지막줄에
/etc/init.d/myd start 라고 추가/저장하면

다음 부팅때부터는 myd 데몬이 자동 실행될거에요..

kaeri17의 이미지

가장 간단한게 윗분이 말씀하신 rc.local에 추가하는 방식이고요, 이러한 시작프로그램이 많을때는 그것들의 순서를 조정하기 위해서 chkconfig를 사용합니다. 사실 chkconfig는 /etc/rc.d/rc(n).d 에 스크립트를 복사하는 파일이고요, 이 스크립트는 기본적으로 start, stop을 인자로 주었을때 시작, 종료를 할 수 있어야 합니다. chkconfig로 등록이 가능하게 하려면 스크립트 맨 위에 무슨 레벨에서 몇번째로 작동을 원한다는 것을 알려주는 것을 써 줘야 합니다. 예를들면 제 서버의 /etc/httpd에는 다음과 같은 줄이 있습니다.
#!/bin/sh
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. \
# It is used to serve HTML files and CGI.
#
#
뭐 이런 식으로 # chkconfig: - 85 15 요런 라인을 스크립트 맨 위에 추가하면 chkconfig로 등록 할 수 있습니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.