daemontools¤ò»È¤¦¥á¥ê¥Ã¥È

  • syslog¤È°Û¤Ê¤ê¥í¥°¤¬³Î¼Â¤Ë¼è¤ì¤ë
  • ¥í¥°¤ÎÍÆÎ̤ò´Æ»ë¤·¤Æ¤¯¤ì¤ë¡£¥í¥°¤Î¥í¡¼¥Æ¡¼¥·¥ç¥ó¤ÏÆüÉդǤϤʤ¯¡¢¤¢¤ë°ìÄêÍÆÎ̤Ë㤷¤¿¤«¤É¤¦¤«¤Ë¤è¤Ã¤Æ¹Ô¤ï¤ì¤ë
  • ¥µ¡¼¥Ó¥¹¤ÎÄɲᦺï½ü¤¬´Êñ¤Ë¤Ç¤­¤ë¡£¥·¥¹¥Æ¥àµ¯Æ°»þ¤Ë¼«Æ°Åª¤Ë³«»Ï¤¹¤ë¤«Èݤ«¤â´Êñ¤Ë»ØÄê¤Ç¤­¤ë
  • ¥µ¡¼¥Ó¥¹¤ò´Æ»ë¤¹¤ë¤¿¤á¤Î¥í¥Ã¥¯¥Õ¥¡¥¤¥ë¤òºî¤é¤Ê¤¯¤ÆºÑ¤à
  • ¥Ç¡¼¥â¥ó¤ÎPID¤òľÀÜÄ´¤Ù¤Ê¤¯¤Æ¤â¥·¥°¥Ê¥ë¤¬Á÷¤ì¤ë¡£daemontools¤ò»È¤Ã¤ÆÁö¤é¤»¤¿³Æ¥Ç¡¼¥â¥ó¤ÏPID¤Ç¤Ï¤Ê¤¯Ì¾Á°¤Ç»ØÄê¤Ç¤­¡¢Ê£¿ô¤Î¥Ç¡¼¥â¥ó¤Ë¥·¥°¥Ê¥ë¤òÁ÷¤ë¤³¤È¤â²Äǽ
  • µ¯Æ°¤¹¤ë¥Ç¡¼¥â¥ó¤´¤È¤Ëlimit¤¬¤«¤±¤é¤ì¤ë¡£¤³¤ì¤Ë¤è¤ê¡¢¥á¥â¥ê»ÈÍÑÎ̤ä¥æ¡¼¥¶¡¼¸¢¸Â¤òÀ©¸Â¤Ç¤­¤ë

»²¹Í http://www.unixuser.org/%7Eeuske/doc/daemontools/myfaq/faq-1.html#3

¥¤¥ó¥¹¥È¡¼¥ë

http://cr.yp.to/daemontools/install.html ¤«¤é daemontools-0.76.tar.gz ¤ò¥²¥Ã¥È

# mkdir -p /package
# chmod 755 /package
# chmod +t /package
# cd /package
# tar xvpfz /usr/local/src/daemontools-0.76.tar.gz
# cd admin/daemontools-0.76
# ./package/install 

RedHat9¤Ç¥¨¥é¡¼¤¬½Ð¤ë¾ì¹ç¤Ï¥Ñ¥Ã¥Á¤ò¤¢¤Æ¤Æ¤ß¤è¤¦
http://www.qmail.org/moni.csi.hu/pub/glibc-2.3.1/
¤³¤ì¤Ç°Ê²¼¤Î¤â¤Î¤¬¤Ç¤­¤ë

  • ¿·¤¿¤ËºîÀ®¤µ¤ì¤ë¥Ç¥£¥ì¥¯¥È¥ê
    /service
    /command
  • ºîÀ®¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤ª¤è¤Ó¤½¤Î¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯
    /package/admin/daemontools/command/²¼¤Ë¼Â¹Ô¥Õ¥¡¥¤¥ë
    /command/²¼¤Ë¤½¤Î¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯
    /usr/local/bin/²¼¤Ë¤µ¤é¤Ë¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯

¤Þ¤¿¡¢/etc/inittab¥Õ¥¡¥¤¥ë¤ÎËöÈø¤Ë¼¡¤Î1¹Ô¤¬Äɲ䵤ì¤ë

SV:123456:respawn:/command/svscanboot 

¥¤¥ó¥¹¥È¡¼¥ë¤Î³Îǧ

# ps ax | grep svscan

°Ê²¼¤Î¤è¤¦¤Ëɽ¼¨¤µ¤ì¤ì¤ÐOK

24886 ? S 0:00 /bin/sh /command/svscanboot
24888 ? S 0:00 svscan /service
24957 pts/2 S 0:00 grep svscan

ÆüÉÕ½èÍý¤Î³Îǧ
²¼¤Î¤è¤¦¤Ëº¸¤È±¦¤ÇƱ¤¸¤Ê¤é¤ÐOK

# date | tai64n | tai64nlocal
2002-07-05 11:44:24.382558500 2002ǯ 7·î 5Æü ¶âÍËÆü 11:44:24 JST
# date | sh -c 'multilog t e 2>&1' | tai64nlocal
2002-07-05 11:44:37.138256500 2002ǯ 7·î 5Æü ¶âÍËÆü 11:44:37 JST

rc¥¹¥¯¥ê¥×¥È¤ÎÃÖ¤­´¹¤¨

¿·µ¬¤Ësupervise¤Ç¥×¥í¥»¥¹¤òµ¯Æ°¤·¤¿¤¤¾ì¹ç¡¢/service¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤òºî¤ê¥¹¥Æ¥£¥Ã¥­¡¼¥Ó¥Ã¥È¤òΩ¤Æ¤ëºî¶È¤ò½Ö»þ¤Ë¹Ô¤Ê¤¦É¬Íפ¬¤¢¤ë¤Î¤Ç¡¢¤Þ¤º/var/qmail/service¤Çºî¶È¤·¡¢¸å¤«¤é/service¤Ë¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤òÄ¥¤ë¤³¤È¤Ë¤¹¤ë

# mkdir -p /var/qmail/services/qmail/log
# chmod +t /var/qmail/services/qmail

run¥¹¥¯¥ê¥×¥È¤òºîÀ®

# vi /var/qmail/services/qmail/run
#!/bin/sh
PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin
exec /var/qmail/rc
# vi /var/qmail/services/qmail/log/run
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s8000000 n50 /var/log/qmail

multilog¤Ît¥ª¥×¥·¥ç¥ó¤ÏTAI64N·Á¼°¤Î¥¿¥¤¥à¥¹¥¿¥ó¥×¤òÉÕ¤±¤ë¤È¤¤¤¦¤³¤È¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤¬99999bytes¤Ë¤Ê¤ë¤È¥Õ¥¡¥¤¥ë¤Î¥í¡¼¥Æ¡¼¥·¥ç¥ó¤ò¹Ô¤¤¡¢ºÇÂç¥Õ¥¡¥¤¥ë¿ô10°Ê¾å¤Ë¤Ê¤Ã¤¿¾ì¹ç¤Ï¡¢¸Å¤¤¤â¤Î¤«¤éºï½ü¤µ¤ì¤ëºÇÂç¥Õ¥¡¥¤¥ë¥µ¥¤¥º¡¢ºÇÂç¥Õ¥¡¥¤¥ëÊÝ»ý¿ô¤òÊѹ¹¤¹¤ë¤Ë¤Ï¼¡¤Î¤è¤¦¤Ëµ­½Ò¤¹¤ë

exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s¥µ¥¤¥º n¥Õ¥¡¥¤¥ë¿ô /var/log/qmail
(¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤Ï4096¡Á16777215¤Î´Ö¤Ç»ØÄê)
# chmod +x /var/qmail/services/qmail/run
# chmod +x /var/qmail/services/qmail/log/run

/var/qmail/rc¤ÎÊÔ½¸

#!/bin/sh

# Using splogger to send the log through syslog.
# Using qmail-local to deliver messages to ~/Mailbox by default.

exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start ./Maildir/ splogger qmail

splogger qmail ¤ÎÉôʬ¤òºï½ü

¥í¥°½ÐÎÏÀè¤ÎºîÀ®

# mkdir /var/log/qmail
# chown qmaill.nofiles /var/log/qmail
# chmod 700 /var/log/qmail

¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤òÄ¥¤Ã¤Æqmail¤Îµ¯Æ°

# /etc/rc.d/init.d/qmaild stop
# ln -s /var/qmail/services/qmail /service/qmail

µ¯Æ°³Îǧ

# svstat /service/qmail
/service/qmail: up (pid 27228) 287 seconds
# svstat /service/qmail/log
/service/qmail/log: up (pid 25310) 769 seconds

uptime¤¬0¤ä1¤ò·«¤êÊÖ¤·¤Æ¤¤¤ë¾ì¹ç¤Ïµ¯Æ°¤Ë¼ºÇÔ¤·¤Æ¤¤¤ë¤Î¤Ç¤³¤ì¤Þ¤Ç¤Î¤³¤È¤ò¸«Ä¾¤·¤ÆÈ¿¾Ê¤·¤¿¸å¡¢½¤Àµ¤¹¤ë

qmail-smtpd¤ÎÃÖ¤­´¹¤¨

# mkdir -p /var/qmail/services/smtpd/log
# chmod +t /var/qmail/services/smtpd

run¥¹¥¯¥ê¥×¥È¤òºîÀ®

# vi /var/qmail/services/smtpd/run
#!/bin/sh
PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin
tcpserver -H -R -v -u qmaild -g nofiles -x /etc/tcp.smtp.cdb \
0 smtp /var/qmail/bin/qmail-smtpd 2>&1

tcpserver¤Î¥ª¥×¥·¥ç¥ó»²¹Í¥µ¥¤¥È
http://www.emaillab.org/djb/tcpserver/options.html

# vi /var/qmail/services/smtpd/log/run
#!/bin/sh
exec /usr/local/bin/setuidgid qmails /usr/local/bin/multilog t s5000000 n20 /var/log/smtpd
# chmod +x /var/qmail/services/smtpd/run
# chmod +x /var/qmail/services/smtpd/log/run

¥í¥°½ÐÎÏÀè¤ÎºîÀ®

# mkdir /var/log/smtpd
# chown qmails.nofiles /var/log/smtpd
# chmod 700 /var/log/smtpd

¥·¥ó¥Ü¥ê¥Ã¥¯ºîÀ®¤Èµ¯Æ°³Îǧ

# ln -s /var/qmail/services/smtpd /service/smtpd
# svstat /service/smtpd/
/service/smtpd/: up (pid 27345) 4 seconds
# svstat /service/smtpd/log
/service/smtpd/log: up (pid 27346) 8 seconds

qmail-pop3d¤ÎÃÖ¤­´¹¤¨

# mkdir -p /var/qmail/services/pop3d/log
# chmod +t /var/qmail/services/pop3d

run¥¹¥¯¥ê¥×¥È¤òºîÀ®

# vi /var/qmail/services/pop3d/run

qmailñÂΤǻȤäƤ¤¤ë¾ì¹ç

#!/bin/sh
PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin
exec tcpserver -v 0 pop3 /var/qmail/bin/qmail-popup [¥µ¡¼¥Ð¤ÎFQDN] \
/bin/checkpassword /var/qmail/bin/qmail-pop3d Maildir 2>&1

vpopmail¤ò»È¤Ã¤Æ¤¤¤ë¾ì¹ç

#!/bin/sh
PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin
exec tcpserver -v 0 pop3 /var/qmail/bin/qmail-popup [¥µ¡¼¥Ð¤ÎFQDN] \
/home/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir 2>&1 
# vi /var/qmail/services/pop3d/log/run
#!/bin/sh
exec /usr/local/bin/setuidgid qmailp /usr/local/bin/multilog t s2000000 n20 /var/log/pop3d
# chmod +x /var/qmail/services/pop3d/run
# chmod +x /var/qmail/services/pop3d/log/run

¥í¥°½ÐÎÏÀè¤ÎºîÀ®

# mkdir /var/log/pop3d
# chown qmailp.nofiles /var/log/pop3d
# chmod 700 /var/log/pop3d

¥·¥ó¥Ü¥ê¥Ã¥¯ºîÀ®¤Èµ¯Æ°³Îǧ

# ln -s /var/qmail/services/pop3d /service/pop3d
# svstat /service/pop3d
/service/pop3d: up (pid 27404) 5 seconds
# svstat /service/pop3d/log
/service/pop3d/log: up (pid 27405) 10 seconds

¥×¥í¥»¥¹¤ÎÄä»ß¤Èµ¯Æ°

qmail-pop3d¤òÄä»ß¤¹¤ë¾ì¹ç

# svc -d /service/pop3d
# svstat /service/pop3d
/service/pop3d: down 2 seconds, normally up

qmail-pop3d¤òµ¯Æ°¤¹¤ë¾ì¹ç

# svc -u /service/pop3d

Ää»ß¤·¤Æ¤¤¤Æ¤â¥µ¡¼¥Ð¡¼¤òºÆµ¯Æ°¤µ¤»¤ë¤È¤Þ¤¿Æ°¤¤¤Æ¤·¤Þ¤¦¤Î¤Ç¡¢Ää»ß¤µ¤»¤Æ¤ª¤­¤¿¤¤¾ì¹ç¤Ïdown¥Õ¥¡¥¤¥ë¤òºîÀ®¤¹¤ë

# touch /service/pop3d/down

¤¹¤Ç¤Ë¥×¥í¥»¥¹¤¬Î©¤Á¾å¤¬¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ïsvc¥³¥Þ¥ó¥É¤ÇÄä»ß¤¹¤ëɬÍפ¬¤¢¤ë

¥×¥í¥»¥¹¤Îºï½ü

¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤òºï½ü¤·¤ÆºÆµ¯Æ°¤¹¤ì¤ÐOK¤À¤¬¡¢¤½¤ê¤ã¤Ç¤­¤ó¡ª¤È¤¤¤¦¾ì¹ç¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ë

¥µ¡¼¥Ó¥¹¤ÎÄä»ß

# svc -d /service/pop3d/log
# svc -d /service/pop3d

¥µ¡¼¥Ó¥¹¤Î¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤Î̾Á°Êѹ¹

# mv /service/pop3d /service/.pop3d

supervise¤ò½ªÎ»¤µ¤»¤ë

# svc -x /service/.pop3d/log
# svc -x /service/.pop3d

³Îǧ¤·¤Æ°Ê²¼¤Î¤è¤¦¤Ê¥á¥Ã¥»¡¼¥¸¤¬½Ð¤ì¤ÐOK

# svstat /service/.pop3d
/service/.pop3d/log: supervise not running

µ­Ï¿¤µ¤ì¤¿¥í¥°¤Î»þ´Ö¤òÆɤá¤ë¤è¤¦¤Ë¤¹¤ë

TAI64N·Á¼°¤Çµ­Ï¿¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¤³¤ì¤òÊÑ´¹¤¹¤ë

# tai64nlocal < TAI64N·Á¼°¤Çµ­Ï¿¤µ¤ì¤¿¥í¥°¥Õ¥¡¥¤¥ë

¥È¥Ã¥×   ÊÔ½¸ Åà·ë º¹Ê¬ ¥Ð¥Ã¥¯¥¢¥Ã¥× źÉÕ Ê£À½ ̾Á°Êѹ¹ ¥ê¥í¡¼¥É   ¿·µ¬ °ìÍ÷ ¸¡º÷ ºÇ½ª¹¹¿·   ¥Ø¥ë¥×   ºÇ½ª¹¹¿·¤ÎRSS
Last-modified: 2021-09-19 (Æü) 19:09:32