daemontools¤ò»È¤¦¥á¥ê¥Ã¥È †
»²¹Í 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¤Ç¥¨¥é¡¼¤¬½Ð¤ë¾ì¹ç¤Ï¥Ñ¥Ã¥Á¤ò¤¢¤Æ¤Æ¤ß¤è¤¦
¤Þ¤¿¡¢/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 ÆüÉÕ½èÍý¤Î³Îǧ # 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¤Î¥ª¥×¥·¥ç¥ó»²¹Í¥µ¥¤¥È # 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·Á¼°¤ÇµÏ¿¤µ¤ì¤¿¥í¥°¥Õ¥¡¥¤¥ë |