· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
daemontools¼³Ä¡¿Í»ç¿ë

daemontools ¼³Ä¡¿Í »ç¿ë

¹æâÇö(winchild@sds.co.kr) (ÁÖ)»ïÁ¤µ¥ÀÌŸ¼­ºñ½º

ÃÖÁ¾¼öÁ¤ÀÏ: 2008 ³â 10¿ù 2ÀÏ ¿ÀÈÄ 20½Ã 14ºÐ

{toc}

°³¿ä


DBS Agent °¡ Á¢¼ÓÀÌ ²÷¾îÁö°Å³ª, rebooting µÇ¾úÀ» °æ¿ì ½ÇÇàÀÌ ÁߴܵǴ°ÍÀ» º¸¿ÏÇϱâ À§Çؼ­ DBS Agent ¿¡ daemontool À» Àû¿ëÇÏ´Â °úÁ¤

daemontool ¼³Ä¡


# wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
--13:29:38--  http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
Resolving cr.yp.to... 131.193.36.21
Connecting to cr.yp.to|131.193.36.21|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 36975 (36K) [application/x-gzip]
Saving to: `daemontools-0.76.tar.gz'

100%[===============================================================================================>] 36,975      38.9K/s   in 0.9s

13:29:39 (38.9 KB/s) - `daemontools-0.76.tar.gz' saved [36975/36975]

# ls -l
total 143776
-rw-r--r-- 1 root root    36975 Jul 13  2001 daemontools-0.76.tar.gz
# cd /usr/local/src/
# tar xvzf /home/archives/daemontools-0.76.tar.gz
...
admin/daemontools-0.76/src/openreadclose.h
admin/daemontools-0.76/src/openreadclose.c
# cd daemontools-0.76
# ls
package  src
#

error.h ÆÐÄ¡


daemontools 0.76 Àº error.h °¡ ÆÐÄ¡µÇÁö ¾ÊÀº »óÅ·Π¹èÆ÷µÇ°í ÀÖÀ¸¹Ç·Î, error.h ¸¦ ÆÐÄ¡ÇØ ÁÖ¾î¾ß ÇÑ´Ù.
# cd /home/archives
# wget http://public.planetmirror.com/pub/sf/p/pa/packagers/daemontools-errno.patch
# cd /usr/local/src
# patch -p1 < /home/archives/daemontools-errno.patch
can't find file to patch at input line 30
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|# Copyright (C) 2004 Rhino Maeo LC
|# License:  This file is part of the Packagers project.
|#
|#       The Packagers Project is free software; you can redistribute it and/or
|#       modify it under the terms of the GNU General Public License as published
|#       by the Free Software Foundation; either version 2 of the License, or
|#       (at your option) any later version.
|#
|#       The Packagers Project is distributed in the hope that it will be useful,
|#       but WITHOUT ANY WARRANTY; without even the implied warranty of
|#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
|#       GNU General Public License for more details.
|#
|#       You should have received a copy of the GNU General Public License
|#       along with The Packagers Project; if not, write to the Free Software
|#       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
|#
|# Author: Robert Oldham <robertoldham@rhinomaeo.com>
|# Description:  This patch file patches the daemontools-0.76 error.h file to use
|#       the errno.h header file instead of simply externing errno, which may or
|#       may not be an int, depending on the platform.
|#
|#       For mor information about the purpose of this patch file and other
|#       Packagers files or projects, please see the Packagers Project website at
|#       http://packagers.sourceforge.net.
|#
|diff -uNr admin.orig/daemontools-0.76/src/error.h admin/daemontools-0.76/src/error.h
|--- admin.orig/daemontools-0.76/src/error.h    2001-07-12 10:49:49.000000000 -0600
|+++ admin/daemontools-0.76/src/error.h 2003-10-08 15:07:34.000000000 -0600
--------------------------
File to patch: admin/daemontools-0.76/src/error.h
patching file admin/daemontools-0.76/src/error.h
#

ÆÄÀÏ ¹Þ±â°¡ ¿©ÀÇÄ¡ ¾ÊÀ» °æ¿ì ¾Æ·¡ÀÇ Ã·ºÎÆÄÀÏ daemontools-0.76.tar.gz ¸¦ ¹Þ¾Æ¼­ ÀÌ¿ëÇÑ´Ù.

¼³Ä¡


# cd admin/daemontools-0.76
# package/install
...
Creating symlink daemontools -> daemontools-0.76...
Making command links in /command...
Making compatibility links in /usr/local/bin...
Creating /service...
Adding svscanboot to inittab...
init should start svscan now.
# # ls /command/
envdir     fghack    pgrphack       setlock    softlimit  svc   svscan      svstat  tai64nlocal
envuidgid  multilog  readproctitle  setuidgid  supervise  svok  svscanboot  tai64n
#

* error.h ÆÐÄ¡ÆÄÀÏÀÌ Á¸ÀçÇÏÁö ¾Ê´Â´Ù°í ³ª¿Ã°æ¿ì ÷ºÎÆÄÀÏ daemontools-errno.patch ¸¦ ¹Þ¾Æ¼­ ÀÌ¿ëÇÑ´Ù.

È®ÀÎ


# ps ax|grep svscan
 3619 ?        Ss     0:00 /bin/sh /command/svscanboot
 3621 ?        S      0:00 svscan /service
14530 pts/1    S+     0:00 grep svscan
#

±âµ¿½ºÅ©¸³Æ® ¼³Ä¡


# mkdir /var/supervise
# mkdir /var/supervise/dbs

±âµ¿½ºÅ©¸³Æ®´Â /var/supervise/dbs/run À¸·Î »ý¼º, ÁÖÀÇ ÇÒ°ÍÀº ¹é±×¶ó¿îµå ¸ðµå·Î (-s ¸¦ Á¦°ÅÇÑ ½ÇÇà¸ðµå) ½ÇÇàÇÏÁö ¾Êµµ·Ï ÇÒ°Í. ±×·¯¸é ½ÇÇà½ÃÀÇ pid ¿Í ´Þ¶óÁ®¼­ svscan ÀÌ °è¼Ó Çؼ­ ÇÁ·Î¼¼¼­¸¦ ½ÇÇà½ÃŲ´Ù.
#!/bin/sh
exec /usr/local/bin/setuidgid root /usr/local/bin/dbs -s 

(ÁÖ) dbs ÀÇ °æ·Î°¡ /usr/local/dbs/bin/dbs ·Î µÇ¾î ÀÖÀ»¼ö ÀÖÀ¸¹Ç·Î È®ÀÎÇÏ¿© Àû¿ëÇÑ´Ù.
#!/bin/sh
exec /usr/local/bin/setuidgid root /usr/local/dbs/bin/dbs -s
# chmod 755 /var/supervise/dbs/run 


¼­ºñ½º¿¡ ¿¬°á ¹× È®ÀÎ


# cd /service/
# ln -s /var/supervise/dbs/ .
# ps ax|grep dbs
14590 ?        S      0:00 supervise dbs
14591 ?        Sl     0:00 /usr/local/bin/dbs -s
14609 pts/1    S+     0:00 grep dbs
# ls -l /var/supervise/dbs
total 8
-rwxr-xr-x 1 root root   67 May 30 13:08 run
drwx------ 2 root root 4096 May 30 13:14 supervise
#
# tail /var/log/dbs.log
[Apr 23 16:02:02] [27213] [ERROR] °ü¸®ÀÚ À̸ÞÀÏ ÁÖ¼Ò¸¦ È®ÀÎ ÇÒ ¼ö ¾øÀ½
[Apr 23 16:14:02] [27213] [INFO] 14054¹ø ¹é¾÷ ¿äû
[Apr 23 16:14:02] [27213] [DEBUG] Updated jobs status: UPDATE jobs SET status = 'R', sdate = now() WHERE id = '14054' AND status NOT IN('D', 'F', 'E')
[Apr 23 16:14:12] [27213] [DEBUG] Updated jobs status: UPDATE jobs SET status = 'D', edate = now() WHERE id = '14054' AND status NOT IN('D', 'F', 'E')
[Apr 23 16:14:12] [27213] [INFO] 14054¹ø ¹é¾÷ Á¾·á
[Apr 23 19:10:18] [27213] [ERROR] Socket error: Connection timed out
[Apr 30 17:53:47] [27213] [ERROR] Socket error: Connection reset by peer
[May 30 12:23:11] [14386] [INFO] Direct Backup Solution/1.0 ¼º°øÀûÀ¸·Î ½ÇÇàµÇ¾úÀ½
[May 30 13:13:49] [14573] [INFO] Direct Backup Solution/1.0 ¼º°øÀûÀ¸·Î ½ÇÇàµÇ¾úÀ½
[May 30 13:14:15] [14591] [INFO] Direct Backup Solution/1.0 ¼º°øÀûÀ¸·Î ½ÇÇàµÇ¾úÀ½
#

/service ¿¡ /var/supervise/dbs ¸¦ link ¸¦ °É¾îÁÖ°Ô µÇ¸é supervise µð·ºÅ丮°¡ »ý±â°í, ±× µð·ºÅ丮¾È¿¡ control, lock, ok status µîÀÇ Á¦¾îÆÄÀÏÀÌ »ý¼ºµÇ°í, ÇØ´ç ÇÁ·Î±×·¥ÀÌ Á¾·áµÇ°Ô µÇ¸é, °¨ÁöÇÏ¿© Àç ½ÇÇà ½ÃÄÑ ÁÖ°Ô µÈ´Ù.


ÇÁ·Î¼¼¼­ÀÇ ±¸µ¿°ú Á¤Áö


daemontools ¿¡ ÀÇÇؼ­ ÇÁ·Î¼¼¼­°¡ ±¸µ¿µÇ°Ô µÇ¸é, kill ·Î ÇØ´ç ÇÁ·Î¼¼¼­¸¦ ÁßÁö½Ãų¶§ °¨½Ã ÇÁ·Î¼¼¼­¿¡ ÀÇÇؼ­ À籸µ¿µÇ°Ô µÈ´Ù. µû¶ó¼­ ÇÁ·Î¼¼¼­ÀÇ ±¸µ¿°ú Á¤Áöµµ ÇØ´ç À¯Æ¿¸®Æ¼¸¦ ÅëÇؼ­ ÇØÁÖ¾î¾ß ÇÑ´Ù.

* svc -d /var/supervise/dbs ...... ÇÁ·Î¼¼¼­ Á¤Áö * svc -u /var/supervise/dbs ...... ÇÁ·Î¼¼¼­ ½ÃÀÛ

# svc -d /var/supervise/dbs
# ps ax|grep dbs
14590 ?        S      0:00 supervise dbs
14732 pts/1    S+     0:00 grep dbs
# svc -u /var/supervise/dbs
# !ps
ps ax|grep dbs
14590 ?        S      0:00 supervise dbs
14734 ?        Sl     0:00 /usr/local/bin/dbs -s
14747 pts/1    S+     0:00 grep dbs
#

±¸µ¿½ºÅ©¸³Æ®·Î µî·Ï


init ½ºÅ©¸³Æ®
#!/bin/sh -e
# /etc/init.d/msendd : start or stop the msendd mail subsystem.
# borrowed from http://Web.InfoAve.Net/~dsill/lwq.html#start-msend
# modified by ChangHyun Bang <winchild@sds.co.kr>
# description: dbs init script
# processname: dbs 
# chkconfig: 345 85 15
# pidfile: /var/run/dbs.pid

PATH=$PATH:/usr/local/bin:

case "$1" in
        start)
        echo "Starting backup agent:dbs"
        svc -u /var/supervise/dbs

;;
stop)
        echo "Stopping backup agent: dbs"
        svc -d /var/supervise/dbs
;;
restart)
        $0 stop
        $0 start
;;
*)
        echo 'Usage: /etc/init.d/dbs {start|stop|restart}'
        exit 1
esac

exit 0

ÃʱâÈ­½ºÅ©¸³Æ®·Î µî·Ï


# /sbin/chkconfig --add dbs
# /sbin/chkconfig --level 34 dbs on

È®ÀÎ
# ./dbs stop
Stopping backup agent:  dbs
# ps ax|grep dbs
14590 ?        S      0:00 supervise dbs
14842 pts/1    S+     0:00 grep dbs
# ./dbs start
Starting backup agent: dbs
# ps ax|grep dbs
14590 ?        S      0:00 supervise dbs
14845 ?        Sl     0:00 /usr/local/bin/dbs -s
14858 pts/1    S+     0:00 grep dbs
#


TROUBLE SHUTING


2010³â9¿ù22ÀÏ µî·Ï.

ÃÖ½ÅÀÇ CentOS 5.4 ¹ö¹ø¿¡ ¼³Ä¡ÇÏ·Á´Ù º¸´Ï, ¾Æ·¡¿Í °°Àº ¿¡·¯°¡ ¹ß»ýÇÏ¿´´Ù

/usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in envdir.o 

°ü·Ã°Ë»öÀ» Çغ¸´Ï, http://forums.openhosting.com/viewtopic.php?p=211&amp; ¿¡¼­ ãÀ»¼ö ÀÖ¾ú´Ù.

After you have untarred the daemontools file, go to the: admin/package/src directory and find the file: conf-cc edit this and add the following to the parameter line for gcc: -include /usr/include/errno.h 

Áï src µð·ºÅ丮¾Æ·¡ÀÇ conf-cc ÀÇ gcc ÀÇ ½ÇÇà¿É¼Ç¿¡ "-include /usr/include/errno.h" ¸¦ ºÙÀ̶ó´Â °ÍÀÌ´Ù. ¾Æ·¡¿Í °°ÀÌ...

gcc -O2 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings -include /usr/include/errno.h

±×¸®°í ¾Õ¿¡¼­ ½ÇÇàÇß´ø package/install À» ½ÇÇàÇÏ´Ï, ¼º°øÀûÀ¸·Î ÄÄÆÄÀÏ µÇ¾ú´Ù.


ID
Password
Join
"Heck, I'm having a hard time imagining the DOM as civilized!" -- Fred L. Drake, Jr.


sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2010-09-22 22:11:39
Processing time 0.0047 sec