--------------------------------------------------------------------- ¸®´ª½º ºÎÆ® ÇÁ·Î¼¼½º --------------------------------------------------------------------- ±Û¾´ÀÌ : ±è¿µÈÖ (hwicool1@hanmail.net) ÀÌ ¹®¼­´Â Àü¿øÀ» Ä×À» ¶§ ºÎÅÍ ·Î±×ÀÎ ÇÁ·ÒÇÁÆ®°¡ È­¸é¿¡ ³ªÅ¸³¯ ¶§±îÁö ¸®´ª½º ¿¡¼­ ¹«½¼ ÀÏÀÌ ¹ú¾îÁö´ÂÁö¿¡ ´ëÇÑ ¹®¼­ÀÔ´Ï´Ù. µÇµµ·Ï ÀÚ¼¼ÇÏ°Ô ÀûÀ¸·Á°í ³ë·ÂÇÏ¿´À¸¸ç, ºÎÆà °úÁ¤¿¡¼­ »ç¿ëµÇ´Â ½ºÅ©¸³Æ®¿¡ ´ë Çؼ­µµ ºÐ¼®(?)Çϵµ·Ï ³ë·ÂÇÏ¿´½À´Ï´Ù. ·¹µåÇÞ ±â¹ÝÀÇ ¹èÆ÷ÆÇÀ» ±âÁØÀ¸·Î Àâ¾Æ ¼³¸íÇßÀ¸¹Ç·Î ´Ù¸¥ ¹èÆ÷ÆÇÀÇ ºÎÆà °úÁ¤ °ú´Â Â÷ÀÌ°¡ ÀÖÀ» ¼ö ÀÖ½À´Ï´Ù. ±×·¯³ª, ÃÖÃÊÀÇ ºÎÆðúÁ¤Àº ±âº»ÀûÀ¸·Î µ¿ÀÏÇϱ⠶§¹®¿¡ ÂüÁ¶ÇϽñ⠹ٶø´Ï´Ù. ÁÖÀÇ : ¹®¼­¿¡¼­ ºÎÁ·ÇÑ ºÎºÐÀ̳ª, À߸øµÈ ºÎºÐ µîÀº ¸ÞÀÏ·Î µû²ûÇÏ°Ô ¾Ë·Á ÁÖ½Ã¸é ¹Ù·Î °íÄ¡µµ·Ï ÇÏ°Ú½À´Ï´Ù. (»ç½Ç, Àß ¸ð¸£´Â ºÎºÐÀº ´ÙÀ½¿¡ ´õ °øºÎÇؼ­ ³Ö±â·Î ÇÏ°í, ¾ó¹ö¹«·È°Åµç¿ä ^^;) ÀÌ ¹®¼­°¡ ¸®´ª½º ºÎÆà °úÁ¤¿¡ ´ëÇØ ±Ã±ÝÇØ ÇϽô Ãʺ¸ºÐµé¿¡°Ô µµ¿òÀÌ µÇ¾úÀ¸¸é ÁÁ°Ú½À´Ï´Ù. ¹®¼­ ¹öÁ¯ : 0.1.1 (±Û¾´³¯ : 2000. 8. 21) ÃÖ±Ù °»½Å : 2000. 8. 22 -------------------------------------------------------------------- ¼ø ¼­ -------------------------------------------------------------------- 1. Àü¿øÀ» ÄÑ´Â ¼ø°£À¸·ÎºÎÅÍ init ÇÁ·Î¼¼½º°¡ ½ÃÀÛµÉ ¶§±îÁö 2. init ÇÁ·Î¼¼½º¿Í inittab ÆÄÀÏ 3. init : ±× ÀÌÈÄ 4. /etc/rc.d/rc.sysinit, /etc/rc.d/rc 5. ²¿¸´¸», Âü°íÀÚ·á -------------------------------------------------------------------- 1. Àü¿øÀ» ÄÑ´Â ¼ø°£À¸·ÎºÎÅÍ init ÇÁ·Î¼¼½º°¡ ½ÃÀÛµÉ ¶§±îÁö -------------------------------------------------------------------- ¿ì¸®ÀÇ PC ÀÇ Àü¿øÀ» ÄѸé PC ´Â ·Ò¿¡ ÀúÀåµÇ¾î ÀÖ´Â ÃʱâÈ­ ÇÁ·Î±×·¥À» ½ÇÇàÇÕ ´Ï´Ù. ÃʱâÈ­ ÇÁ·Î±×·¥¿¡ ÀÇÇØ ¸Þ¸ð¸® üũ µîÀÌ ¼öÇàµÇ°í ÇÊ¿äÇÑ ÃʱâÈ­°¡ ¿Ï·áµÇ°í ³ª¸é, ÇÏµå µð½ºÅ© ȤÀº ´Ù¸¥ ºÎÆà ¸Åü (Ç÷ÎÇÇ µð½ºÅ©³ª CDROM µî)ÀÇ 0 ¹ø ¼½ÅÍÀÇ ºÎÆ® ÇÁ·Î±×·¥À» ÀнÀ´Ï´Ù. º¸Åë, 0¹ø ¼½Å͸¦ MBR (Master Boot Record) À̶ó°í ÇÕ´Ï´Ù. ¿©±â´Â ¸®´ª½º¸¦ À§ÇÑ lilo °¡ µé¾î ÀÖÀ» ¼öµµ ÀÖ°í, NT ³ª OS/2 µî ´Ù¸¥ ¿î¿µÃ¼Á¦ÀÇ ºÎÆ® ·Î´õ°¡ µé¾î ÀÖÀ» ¼öµµ ÀÖ½À´Ï´Ù. lilo °¡ MBR ¿¡ ÀÖ´Ù°í °¡Á¤ÇÏ°í °è¼Ó ÁøÇàÇÏ°Ú½À´Ï´Ù. lilo ´Â Ä¿³ÎÀ» ½ÇÇàÇϱâ À§Çؼ­ »ç¿ëÀÚÀÇ ÀÔ·ÂÀ» ±â´Ù¸³´Ï´Ù. ¿©·¯ºÐÀÌ ÄÄÇ»Å͸¦ Ä×À»¶§ ³ª¿À´Â lilo: ¶ó´Â ÇÁ·ÒÇÁÆ®°¡ ±×°ÍÀÔ´Ï´Ù. À̶§ ¿ì¸®´Â lilo ¶ó´Â ÇÁ·ÒÇÁÆ® µÚ¿¡ Ä¿³Î¿¡ ÁÖ°í½ÍÀº ¿É¼ÇÀ̳ª, ºÎÆÃÇÏ°íÀÚ ÇÏ´Â Ä¿³ÎÀÇ À̹ÌÁö¸¦ ÁöÁ¤ÇØ ÁÙ ¼ö ÀÖ½À´Ï´Ù. ÀÌ¿¡ °üÇÑ ÀÚ¼¼ÇÑ ³»¿ëÀº lilo HOWTO ¹®¼­¸¦ ÂüÁ¶ÇϽʽÿÀ. ÀÌÁ¦, »ç¿ëÀÚ´Â lilo ¿¡ ½ÇÇà½ÃÅ°±â¸¦ ¿øÇÏ´Â Ä¿³ÎÀÇ À̹ÌÁö¸¦ Ä¿³Î¿¡ ³Ñ°ÜÁÖ°íÀÚ ÇÏ´Â ¿É¼Ç°ª°ú ÇÔ²² ¾Ë·ÁÁÝ´Ï´Ù. ±×¸®°í, lilo ´Â ÇØ´çÇÏ´Â Ä¿³ÎÀÇ À̹ÌÁö¸¦ ·ÎµùÇؼ­ ½ÇÇàÇÏ°Ô µË´Ï´Ù. ±âº» ¼³Á¤À¸·Î´Â /vmlinuz ¶Ç´Â /boot/vmlinuz À̹ÌÁö°¡ ½ÇÇàµË´Ï´Ù. vmlinuz ´Â ¸®´ª½º Ä¿³ÎÀÇ ¾ÐÃà À̹ÌÁöÀÔ´Ï´Ù. ¿©±â¼­ swapper ¶ó°íµµ ºÒ¸®¿ì´Â ÇÁ·Î¼¼½º id 0 ÀÎ ÇÁ·Î¼¼½º°¡ ½ÇÇàµË´Ï´Ù. ÀÌ ÇÁ·Î¼¼½º´Â ¿î¿µÃ¼Á¦ ±× ÀÚü¶ó°íµµ ÇÒ ¼ö ÀÖ´Â ÇÁ·Î¼¼½º·Î½á, ¸Þ¸ð¸® °ü¸®, µð½ºÅ© °ü¸®, ÇÁ·Î¼¼½º °ü¸® µîÀ» ¼öÇàÇÕ´Ï´Ù. ÀÌ ÇÁ·Î¼¼½º´Â ÇÁ·Î¼¼½º id 1 ÀÎ init ¶ó´Â ÇÁ·Î¼¼½º¸¦ ½ÇÇà½ÃÅ°°í´Â º»¿¬ÀÇ ±â´ÉÀÎ swapper ·Î½áÀÇ ±â´ÉÀ» ¼öÇàÇϱ⠽ÃÀÛÇÕ´Ï´Ù. ¿©±â¼­ swapper °¡ ¹«½¼ ÀÏÀ» ÇÏ´ÂÁö °£´ÜÇÏ°Ô À̾߱âÇØ º¸°Ú½À´Ï´Ù. À¯´Ð½º ½Ã½ºÅÛ¿¡¼­ ½ÇÇàµÇ´Â ¸ðµç ÇÁ·Î¼¼½ºµéÀº "ÀÏ»ý(lifetime)(?)"À» °¡Áö°í ÀÖ½À´Ï´Ù. ÇÁ·Î¼¼½º »ý¼º¿¡¼­ºÎÆ® Á¾·á½Ã±îÁö... ±×µ¿¾È cpu ¸¦ Á¡À¯Çϸ鼭 ½ÇÇàµÇ´Â ½Ã°£µµ ÀÖÀ» °ÍÀÌ°í, ÇÒ ÀÏ ¾øÀÌ »ç¿ëÀڷκÎÅÍÀÇ ÀÔ·ÂÀ» ±â´Ù¸°´ÙµçÁöÀÇ ÀÌÀ¯·Î "Àáµé¾î" ÀÖ´Â ½Ã°£µµ ÀÖ½À´Ï´Ù. swapper ÇÁ·Î¼¼½º¿¡ ´ëÇØ ¼³¸íÇϸ鼭 ÀÌ À̾߱⸦ ÇÏ´Â ÀÌÀ¯´Â swapper °¡ ÇÏ´Â ÀÏÀÌ ¹Ù·Î, "Àáµé¾î" ÀÖ´Â ÇÁ·Î¼¼½º¸¦ ¸Þ¸ð¸®¿¡¼­ ³»·Á¼­ µð½ºÅ© °ø°£¿¡ Àá½Ã "½º¿Ò"½ÃÄ×´Ù°¡, ±× ÇÁ·Î¼¼½º°¡ ±ú¾î³ª¾ß¸¸ ÇÒ ½Ã±â°¡ ¿À¸é, µð½ºÅ©ÀÇ ÇÁ·Î¼¼½º¸¦ ´Ù½Ã ¸Þ¸ð¸®·Î ÀûÀçÇØ ÁÖ´Â µîÀÇ ÀÏÀ» Çϱ⠶§¹®ÀÔ´Ï´Ù. ¿¹¸¦ µé¾î¼­, Áö±Ý ½Ã½ºÅÛ¿¡ ³Ê¹« ¸¹Àº ÇÁ·Î¼¼½º°¡ ½ÇÇàµÇ°í À־ ±×³ÑµéÀÌ ´Ù µé¾î°¥ ¸¸Å­ ¸Þ¸ð¸®°¡ Å©Áö ¾Ê´Ù°í °¡Á¤ÇսôÙ. ±×·²¶§, ½Ã°£ÀÌ Á» ¸¹ÀÌ °É¸®´Â I/O ¿äûÀ» ÇÑ ÇÁ·Î¼¼½º¶óµçÁö, »ç¿ëÀÚÀÇ ÀÔ·ÂÀ» ±â´Ù¸®´Â ÇÁ·Î¼¼½º ¶óµçÁö.. Áö±Ý sleep »óÅ·ΠÀÖ´Â ÇÁ·Î¼¼½º (¿¹¸¦ µé¸é, httpd °°Àº°Ç ´ëºÎºÐÀÇ ½Ã°£À».. - ±×¸® Á¢¼ÓÀÌ ¸¹Áö ¾ÊÀº À¥ ¼­¹ö¶ó¸é - port ¿¡¼­ ¿äûÀÌ µé¾î¿À±æ ±â´Ù¸®¸é¼­ Àáµé¾î ÀÖ´Â (asleep) »óÅÂÀÌ°ÚÁÒ?) ¿Í °°Àº ³ÑµéÀº Áö±Ý ´çÀå ¸Þ¸ð¸®¿¡ ÀÖÀ» ÇÊ¿ä°¡ ¾ø´Â °ÍÀÔ´Ï´Ù. ±×·¯¸é, Áö±Ý ¸Þ¸ð¸®°¡ ¸ðÀÚ¶ó´Ï±î µð½ºÅ©·Î "½º¿Ò" À» Çؼ­ ´çÀå ½ÇÇàµÇ¾î¾ß ÇÏ´Â ÇÁ·Î¼¼½º¸¦ À§ÇÑ ¸Þ¸ð¸® °ø°£À» ´Ã¸®¸é µÇ°ÚÁÒ? À̶§ swapper °¡ ÀÛµ¿À» Çؼ­ ¸Þ¸ð¸®¿¡ ÀÖ´Â ÇÁ·Î¼¼½º¸¦ µð½ºÅ©·Î Àá½Ã ¿Å°Ü µÎ´Â (swap out) °ÍÀÔ´Ï´Ù. ¶Ç, swapper ´Â ¹Ý´ë·Î µð½ºÅ©¿¡ ½º¿ÒµÇ¾î ÀÖ´Â ÇÁ·Î¼¼½º°¡ ¸Þ¸ð¸®·Î ÀûÀçµÇ¾î¼­ ½ÇÇàµÇ¾î¾ß ÇÒ ÇÊ¿ä°¡ ÀÖÀ»¶§¿¡µµ ½º¿ÒµÈ ÇÁ·Î¼¼½º¸¦ ¸Þ¸ð¸®·Î ´Ù½Ã ¿Ã¸®´Â(swap in) ÀÏÀ» Çϱ⵵ ÇÕ´Ï´Ù. ¸®´ª½ºÀÇ ¸ðµç ÇÁ·Î¼¼½º´Â ¸ðµÎ "ºÎ¸ð" ÇÁ·Î¼¼½º¸¦ °¡Áö°í ÀÖ½À´Ï´Ù. Áï, ±× ÇÁ·Î¼¼½º¸¦ »ý¼º½ÃŲ ³ÑÀÌ Á¸ÀçÇÑ´Ù´Â ¾ê±âÀÔ´Ï´Ù. ±×·¯³ª, ´Ü Çϳª. pid °¡ 0 ÀÎ swapper ÇÁ·Î¼¼½º¸¸Àº(ÀÌ°Ç ÇÁ·Î¼¼½º¶ó±â º¸´Ù´Â ¿î¿µÃ¼Á¦ ÀÚü¶ó°í Çصµ ÁÁÀ» °Å °°½À´Ï´Ù.) ºÎ¸ð°¡ Á¸ÀçÇÏÁö ¾Ê°í, lilo µî¿¡ ÀÇÇؼ­ "¼öµ¿"À¸·Î ½ÇÇàÀÌ µË´Ï´Ù. ³ª¸ÓÁö ÇÁ·Î¼¼½º´Â ¸ðµÎ fork() ½Ã½ºÅÛ ÄÝ°ú exec() ½Ã½ºÅÛ ÄÝÀ» ÀÌ¿ëÇؼ­ »ý¼ºÀÌ µË´Ï´Ù. ¶Ç ¿©±â¼­, fork() ½Ã½ºÅÛ ÄÝ°ú exec() ½Ã½ºÅÛ ÄÝ¿¡ ´ëÇØ °£´ÜÈ÷ À̾߱âÇÏ°í ³Ñ¾î°¡°Ú½À´Ï´Ù. UNIX ½Ã½ºÅÛ ÇÁ·Î±×·¡¹ÖÀ» °øºÎÇØ º¸½Å ºÐµéÀ» ´Ù Àß ¾Æ½Ã´Â ³»¿ëÀÏ °ÍÀÔ´Ï´Ù. fork() ³ª exec() ¸ðµÎ ÇÑ ÇÁ·Î¼¼½º°¡ ´Ù¸¥ ÇÁ·Î¼¼½º¸¦ ½ÇÇà½ÃÅ°±â À§ÇØ »ç¿ëÇÏ´Â ½Ã½ºÅÛ È£ÃâÀÔ´Ï´Ù. µÎ ÇÔ¼öÀÇ Â÷ÀÌÁ¡À» À§ÁÖ·Î ¼³¸íÇϸé, ¿ì¼± fork() ½Ã½ºÅÛ È£ÃâÀº »õ·Î¿î ÇÁ·Î¼¼½º¸¦ À§ÇÑ ¸Þ¸ð¸®¸¦ ÇÒ´çÇÕ´Ï´Ù. ±×¸®°í, fork() ¸¦ È£ÃâÇÑ ÇÁ·Î¼¼½º¸¦ »õ·Î¿î °ø°£À¸·Î ½Î±×¸® º¹»çÇÕ´Ï´Ù. ±×¸®°í ³ª¼­ ¿ø·¡ ÇÁ·Î¼¼½º´Â ¿ø·¡ ÇÁ·Î¼¼½º´ë·Î ½ÇÇàµÇ°í, fork() ¸¦ ÀÌ¿ëÇؼ­ »ý¼ºµÈ ÇÁ·Î¼¼½ºµµ ±× ³ª¸§´ë·Î fork() ½Ã½ºÅÛ ÄÝÀÌ ¼öÇàµÈ ¶óÀÎÀÇ ´ÙÀ½ ¶óÀκÎÅÍ ½ÇÇàÀÌ µË´Ï´Ù. (»õ·Î »ý¼ºµÈ ÇÁ·Î¼¼½º´Â ¿ø·¡ÀÇ ÇÁ·Î¼¼½º¶û ¶È°°Àº Äڵ带°¡Áö°í ÀÖ½À´Ï´Ù.) ¹Ý¸é, exec() ½Ã½ºÅÛ ÄÝÀº fork() ó·³ »õ·Î¿î ÇÁ·Î¼¼½º¸¦ À§ÇÑ ¸Þ¸ð¸®¸¦ ÇÒ´çÇÏÁö ¾Ê°í, exec() ¸¦ È£ÃâÇÑ ÇÁ·Î¼¼½ºÀÇ ¸Þ¸ð¸®¿¡ »õ·Î¿î ÇÁ·Î¼¼½ºÀÇ Äڵ带 µ¤¾î¾º¿ö ¹ö¸³´Ï´Ù. µû¶ó¼­ exec() ¸¦ È£ÃâÇÑ ÇÁ·Î¼¼½º°¡ ¾Æ´Ñ exec() ¿¡ ÀÇÇØ È£ÃâµÈ ÇÁ·Î¼¼½º¸¸ ¸Þ¸ð¸®¿¡ ³²°Ô µË´Ï´Ù. ´Ù½Ã °£´ÜÇÏ°Ô ¸»Çϸé, fork() ÀÇ °á°ú´Â ÇÁ·Î¼¼½º°¡ Çϳª ´õ »ý±â´Â °ÍÀÔ´Ï´Ù. ¹°·Ð, ÇÁ·Î¼¼½º id (pid) µµ ¿ÏÀüÈ÷ ´Ù¸¥ ¶Ç ÇϳªÀÇ ÇÁ·Î¼¼½º°¡ »ý±â´Â °ÍÀÌÁÒ. ¹Ý¸é, exec() ½ÇÇàÀÇ °á°ú·Î »ý¼ºµÇ´Â »õ·Î¿î ÇÁ·Î¼¼½º´Â ¾ø½À´Ï´Ù. exec() ¸¦ È£ÃâÇÑ ÇÁ·Î¼¼½ºÀÇ pid °¡ ±×´ë·Î »õ·Î¿î ÇÁ·Î¼¼½º¿¡ Àû¿ëÀÌ µÇ¸ç, exec() ¸¦ È£ÃâÇÑ ÇÁ·Î¼¼½º´Â »õ·Î¿î ÇÁ·Î¼¼½º¿¡ ÀÇÇØ µ¤¾î¾²¿©Áö°Ô µË´Ï´Ù. -------------------------------------------------------------------- 2. init ÇÁ·Î¼¼½º¿Í inittab ÆÄÀÏ -------------------------------------------------------------------- ÇÁ·Î¼¼½º id 1 ¹øÀÎ init ÇÁ·Î¼¼½º´Â »ç¿ëÀÚµéÀ» À§Çؼ­ ½Ã½ºÅÛÀ» ¼³Á¤ÇÏ°Ô µË´Ï´Ù. pid 0 ÀÎ ÇÁ·Î¼¼½º°¡ ÃʱâÈ­(?)ÇÑ Ä¿³ÎÀÇ ¹ÙÅÁ¿¡¼­ ³ª¸ÓÁö ÀÛ¾÷À» ¼öÇàÇÏ´Â °ÍÀÌÁÒ. init ÇÁ·Î¼¼½º°¡ ÇÏ´ÂÀÏÀº ÆÄÀϽýºÅÛÀÇ ±¸Á¶¸¦ °Ë»çÇÏ°í, ÆÄÀϽýºÅÛÀ» ¸¶¿îÆ®ÇÏ°í, ¼­¹ö µ¥¸óÀ» ¶ç¿ì°í, »ç¿ëÀÚ ·Î±×ÀÎÀ» ±â´Ù¸®°í, »ç¿ëÀÚ°¡ ·Î±×ÀÎ Çϸé, »ç¿ëÀÚ¸¦ À§ÇÑ ½©À» ¶ç¿ì´Â °Í±îÁöÀÇ °ÍµéÀÔ´Ï´Ù. init °¡ óÀ½ ½ÃÀÛÇؼ­ ¼öÇàÇØ¾ß ÇÒ ÀÛ¾÷µéÀ» ¼³Á¤ÇÑ ÆÄÀÏÀº /etc/inittab ÆÄÀÏ ÀÔ´Ï´Ù. init ´Â »õ·Î¿î ½ÇÇà·¹º§¿¡¼­ ½ÇÇàÇÒ ÇÁ·Î¼¼½º¸¦ °áÁ¤Çϱâ À§Çؼ­ ÀÌ ÆÄÀÏÀ» ÂüÁ¶ÇÕ´Ï´Ù. ´Ù½Ã ¸»Çϸé, inittab ÆÄÀÏÀº ½Ã½ºÅÛÀÇ »óÅ¿¡ µû¶ó¼­ ÇØ´çÇÏ´Â ·±·¹º§¿¡¼­ init ÇÁ·Î¼¼½º°¡ ¼öÇàÇØ¾ß ÇÒ ÀϵéÀ» ¼­¼úÇØ ³õÀº ÆÄÀÏÀÔ´Ï´Ù. init ÇÁ·Î±×·¥Àº inittab ÆÄÀÏÀ» ÂüÁ¶ÇÏ¿©¼­ ¸ðµç »õ·Î¿î ·±·¹º§¿¡¼­ ½ÇÇàÇÒ ¼ö ¾ø´Â ÇÁ·Î¼¼½º°¡ ¸¸¾à Áö±Ý ½ÇÇàÁßÀ̸é, ±× ÇÁ·Î¼¼½º¸¦ Á×ÀÌ°í, »õ·Î¿î ·±·¹º§ ¿¡¼­ ½ÇÇàÇؾ߸¸ ÇÏ´Â ÇÁ·Î¼¼½º Áß ÇöÀç ½ÇÇàµÇ°í ÀÖÁö ¾ÊÀº ÇÁ·Î¼¼½º´Â »õ·ÎÀÌ ½ÇÇàÀ» ½Ãŵ´Ï´Ù. ¾Æ·¡¿¡ ¿¹½ÃÇÑ °ÍÀº Á¦ ÄÄÇ»ÅÍ¿¡ ÀÖ´Â inittab ÆÄÀÏÀÔ´Ï´Ù. (Á» ÇãÁ¢Çϱ⠶§¹®¿¡ ÀÌÇØÇØ Áֽñ⠹ٶø´Ï´Ù. ´ÜÁö ¿¹½Ã¿ëÀ¸·Î ÀοëÇÏ¿´½À´Ï´Ù. -_-;) --------------------------------------------------------------------- # # inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, # Modified for RHS Linux by Marc Ewing and Donnie Barnes # # Default runlevel. The runlevels used by RHS are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # id:3:initdefault: # System initialization. si::sysinit:/etc/rc.d/rc.sysinit l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6 # Things to run in every runlevel. ud::once:/sbin/update # Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now # When our UPS tells us power has failed, assume we have a few minutes # of power left. Schedule a shutdown for 2 minutes from now. # This does, of course, assume you have powerd installed and your # UPS connected and working correctly. pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" # If power was restored before the shutdown kicked in, cancel it. pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" # Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6 # Run xdm in runlevel 5 # xdm is now a separate service x:5:respawn:/etc/X11/prefdm -nodaemon --------------------------------------------------------------------- ±×·³ ÀÌÁ¦, inittab ÆÄÀÏÀ» ÇÑÁÙÇÑÁÙ ºÐ¼®ÇØ º¸°Ú½À´Ï´Ù. # À¸·Î ½ÃÀÛÇÏ´Â ÁÙÀº ÁÖ¼®À̶ó´Â°Å ´Ù ¾Ë°í °è½Ç °Ì´Ï´Ù. inittab ÆÄÀÏÀÇ ¿ëµµ¿Í ÀúÀÚ°¡ ³ª¿À°í, °¢ ·±·¹º§(ren level) ¿¡ ´ëÇÑ °£·«ÇÑ Á¤ÀÇ(?)°¡ ³ª¿É´Ï´Ù. # Default runlevel. The runlevels used by RHS are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) ·»·¹º§ 0 Àº ½Ã½ºÅÛÀ» Á¾·áÇÒ ¶§ »ç¿ëµÇ´Â ·±·¹º§ÀÔ´Ï´Ù. ·±·¹º§ 1 Àº ½Ì±Û À¯Àú ¸ðµå¿¡¼­ »ç¿ëµÇ´Â ·¹º§ÀÔ´Ï´Ù. ¿©·¯ºÐÀÌ lilo: ÇÁ·ÒÇÁÆ® ¿¡¼­ linux single À̶ó°í ÀÔ·ÂÇÏ¸é ·±·¹º§ 1 ¿¡¼­ ¸®´ª½º°¡ ½ÃÀÛÇÏ°Ô µË´Ï´Ù. ÀÌ ¶§´Â µðÆúÆ®·Î root ·Î ·Î±×ÀεǸç, ´ë´Ù¼öÀÇ Áß¿äÇÑ µ¥¸óµéÀº ½ÇÇàµÇÁö ¾Ê°Ô ¼³Á¤µÇ¾î ÀÖ½À´Ï´Ù. ·±·¹º§ 2 ´Â NFS ¸¦ Áö¿øÇÏÁö ¾Ê´Â ´ÙÁß »ç¿ëÀÚ ¸ðµå¸¦ Á¤ÀÇÇϸç, ·±·¹º§ 3 Àº ³×Æ®¿öÅ·À» Áö¿øÇÏ´Â ´ÙÁß »ç¿ëÀÚ ¸ðµåÀÔ´Ï´Ù. (µðÆúÆ® ·±·¹º§·Î ÁÖ·Î ÁöÁ¤µË´Ï´Ù.) ·±·¹º§ 4 ´Â ¿©·¯ºÐÀÌ ³ª¸§´ë·Î Á¤ÀÇÇؼ­ ¾µ ¼ö ÀÖ´Â ·±·¹º§ÀÔ´Ï´Ù. ÇÊ¿ä¿¡ µû¶ó¼­ ½ÇÇà½ÃÅ°±â ¿øÇÏ´Â µ¥¸óÀ̳ª ¼­ºñ½º¸¦ /etc/rc.d/rc4.d µð·ºÅ丮 ¹Ø¿¡ ¼³Á¤ÇÔÀ¸·Î½á ¿©·¯ºÐ¸¸ÀÇ Æ¯¼ºÀ» °®´Â °íÀ¯ÀÇ ·±·¹º§À» Á¤ÀÇÇÒ ¼ö ÀÖ½À´Ï´Ù. ·±·¹º§ 5 ´Â X ¸¦ ½ÇÇà½ÃÅ°±â À§ÇÑ ·±·¹º§·Î ¾à¼ÓµÇ¾î ÀÖ½À´Ï´Ù. ·±·¹º§ 6 Àº ½Ã½ºÅÛÀ» ÀçºÎÆýÃÅ°µµ·Ï Á¤ÀÇµÈ ·±·¹º§ÀÔ´Ï´Ù. ¸¸¾à, inittab ÆÄÀÏÀÇ Ã³À½¿¡ ³ª¿À´Â id:3:initdefault: ÀÇ ¶óÀÎÀ» id:6:initdefault: ȤÀº id:0:initdefault: µîÀ¸·Î ÁöÁ¤ÇØ ¹ö¸®¸é, ¿©·¯ºÐÀÇ ¸®´ª½º ½Ã½ºÅÛÀº ºÎÆÃÇÏÀÚ¸¶ÀÚ Á¾·áµÇ¾î ¹ö¸®°Å³ª, Àç½ÃÀÛÀ» °Åµì ¹Ýº¹ÇÏ°Ô µÇ¾î ¹ö¸®¹Ç·Î ÁÖÀÇÇϽñ⠹ٶø´Ï´Ù. Àá±ñ! ·±·¹º§À̶õ ¹«¾ùÀΰ¡... ÇÏ°í »ý°¢ÇϽô ºÐµéÀÌ ÀÖÀ» °Ì´Ï´Ù. ¾Æ¸¶, ¿©±â±îÁö ÀÐÀ¸¼Ì´Ù¸é, ´ëÃæ ÁüÀÛÀº ÇÏ°í °è½Ã¸®¶ó »ý°¢ÇÕ´Ï´Ù. ---------- runlevel À̶õ ------------ init ¸ÇÆäÀÌÁöÀÇ Á¤ÀÇ : ·±·¹º§Àº ¼±ÅÃµÈ ±×·ìÀÇ ÇÁ·Î¼¼½º¸¸ ½Ã½ºÅÛ¿¡¼­ ½ÇÇàµÇµµ·Ï Çã¶ô Çϱâ À§ÇØ ¸¸µç ¼ÒÇÁÆ®¿þ¾î ¼³Á¤ÀÌ´Ù. A runlevel is a software configuration of the system which allows only a selected group of processes to exist. ½Ã½ºÅÛÀ» °ü¸®ÇÏ´Ù º¸¸é, ½Ã½ºÅÛÀÇ Á¡°Ë ȤÀº µð¹ö±ëÀ» À§Çؼ­ º¸Å붧ÀÇ ¼³Á¤ °ú´Â Á» ´Ù¸£°Ô ¸î°¡Áö ¼­ºñ½º¸¦ ½ÃÀÛÇÏÁö ¾Ê°í ºÎÆÃÇÏ°í ½ÍÀº °æ¿ì°¡ ÀÖÀ» °ÍÀÔ´Ï´Ù. ¿¹¸¦ µé¾î¼­, ³×Æ®¿öÅ© Áö¿ø ±â´ÉÀ» off ÇÏ°í¼­ ºÎÆÃÇÏ°í ½Í´ÙµçÁö, ´ÙÁß »ç¿ëÀÚ ¸ðµå°¡ ¾Æ´Ï¶ó ½Ì±Û »ç¿ëÀÚ ¸ðµå·Î ºÎÆÃÇÏ°í ½Í´ÙµçÁö ÇÏ´Â °æ¿ì°¡ »ý±æ ¼ö ÀÖ½À´Ï´Ù. ÀÌó·³ ¼­·Î ´Ù¸¥ ¼³Á¤À¸·Î ºÎÆÃÇϱâ À§Çؼ­ °¢°¢ÀÇ ¼³Á¤À» "·±·¹º§" À̶ó´Â À̸§À¸·Î ³ª´©¾î ³õÀº °ÍÀÔ´Ï´Ù. ±×¸®°í, "·±·¹º§" ¿¡ ´ëÇÑ ¾à¼ÓÀ¸·Î 0, 1, 2, 3, 5, 6 ¹ø ·±·¹º§Àº ¹Ì¸® ¿¹¾àµÇ¾î¼­ "½Ã½ºÅÛ Á¾·á, ÀçºÎÆÃ, ½Ì±ÛÀ¯Àú¸ðµå, ´ÙÁß»ç¿ëÀÚ ¸ðµå, ³×Æ®¿öÅ©°¡ Áö¿øµÇÁö ¾Ê´Â ´ÙÁß »ç¿ëÀÚ ¸ðµå µîÀ¸·Î ÇÏÀÚ" ¶ó°í ¾à¼ÓÀ» ÇØ µÐ °ÍÀÔ´Ï´Ù. (»ç½Ç ¿¹¾àµÈ ·±·¹º§Àº 0, 1, 6 ¹Û¿¡ ¾ø½À´Ï´Ù. ÇÏÁö¸¸ ³ª¸ÓÁö 2, 3, 5 ¹øÀº "°ü·Ê»ó" °¢°¢ÀÇ ÇØ´ç ¿ëµµ·Î »ç¿ëÇÏ°í ÀÖ´Â °Í °°½À´Ï´Ù. ·±·¹º§ 2, 3 Àº SunOS µî ´Ù¸¥ System V °è¿­ÀÇ init ÇÁ·Î¼¼½º¸¦ ¾²´Â ¿î¿µÃ¼Á¦¿¡¼­µµ ¸®´ª½º¿Í µ¿ÀÏÇÏ°Ô »ç¿ëÇÏ°í ÀÖ½À´Ï´Ù.) ±× ¿Ü¿¡ 7, 8, 9¹ø ·±·¹º§µµ »ç¿ëÀÚ°¡ Á¤ÀÇÇؼ­ ¾µ ¼ö ÀÖÁö¸¸, °ü·Ê»ó ±×·¸°Ô ÇÏÁö ¾Ê´Â´Ù°í ÇÕ´Ï´Ù. ±×¸®°í, S ¿Í s ·±·¹º§µµ Ư¼öÇÑ ·±·¹º§·Î½á Á¸ÀçÇÕ´Ï´Ù. ¸¸¾à ¿©·¯ºÐÀÌ ½Ã½ºÅÛ Á¾·á½Ã¿¡ µðÆúÆ®·Î Á¦°øµÇ´Â ÀÏ¿¡ ´õÇؼ­ ½ÇÇà½ÃÅ°°í ½ÍÀº °ÍÀÌ ÀÖ´Ù¸é, ·±·¹º§ 0 ¿¡ Ãß°¡¸¦ ÇÏ½Ã¸é µÇ´Â °ÍÀÔ´Ï´Ù. ÀÌ·¸°Ô °¢°¢ÀÇ ·±·¹º§¿¡ ¿øÇÏ´Â ÀÛ¾÷À» Ãß°¡Çϱâ À§Çؼ­´Â /etc/rc.d/rcN.d µð·ºÅ丮 ¾Æ·¡ÀÇ ½Éº¼¸¯ ¸µÅ©µéÀ» Á¶Á¤ÇÏ½Ã¸é µË´Ï´Ù. ÀÚ¼¼ÇÑ ³»¿ëÀº ÀÌ ¹®¼­ 4Àý¿¡ Àû¾î µÎ¾ú½À´Ï´Ù. ------------------------------------- ÀÌÁ¦ inittab ÆÄÀÏÀÇ Çü½ÄÀ» »ìÆì º¸µµ·Ï ÇÏ°Ú½À´Ï´Ù. ÀÚ¼¼È÷ inittab ÆÄÀÏÀ» º¸½Å ºÐÀ̶ó¸é ¸ðµç ÁÙÀÌ ´ÙÀ½°ú °°Àº Çü½ÄÀ¸·Î µÇ¾î ÀÖ´Ù´Â °ÍÀ» ¾Æ¼ÌÀ» °Ì´Ï´Ù. id:run-levels:action:process Á¦ÀÏ Ã³À½¿¡ ³ª¿À´Â id ´Â ÇØ´ç state¸¦ ±¸ºÐÇϱâ À§ÇÑ ·¹À̺íÀ̶ó°í º¸½Ã¸é µË´Ï´Ù. ±×¸®°í, ±× ´ÙÀ½ÀÇ rul-levels ´Â ±× ÁÙÀÇ ³»¿ëÀ» Àû¿ëÇϱâ À§ÇÑ ·± ·¹º§ÀÇ ¸ñ·ÏÀÔ´Ï´Ù. ±×¸®°í, action Àº ±× ÁÙ(¿£Æ®¸®¶ó°í ÇÏ°Ú½À´Ï´Ù.), ¿£Æ®¸®¿¡ ÀÇÇØ ½ÇÇàµÇ´Â ÇÁ·Î¼¼½º¸¦ ¾î¶»°Ô ÇÒ °ÍÀΰ¡¿¡ ´ëÇÑ ¼³¸íÀÔ´Ï´Ù. ¸¶Áö¸·À¸·Î ³ª¿À´Â process ´Â ÇÁ·Î¼¼½ºÀÇ ½ÇÇàÆÄÀÏÀÇ °æ·Î¿Í ÇÁ·Î¼¼½º¿¡ ³Ñ°ÜÁÙ ÀμöÀÔ´Ï´Ù. (½©¿¡¼­ ½ÇÇà½ÃÅ°´Â ¸í·É¾î¿Í °°Àº Çü½ÄÀ̶ó°í »ý°¢Çϼ¼¿ä, Áï, ÇØ´ç ¿£Æ®¸®¸¦ ½ÇÇàÇÒ ¶§ process ºÎºÐ¿¡ ³ª¿À´Â ¸í·É¾î·Î ½ÇÇàÇ϶ó´Â ¶æÀÔ´Ï´Ù. -_-;) action ºÎºÐ¿¡ ¿Ã ¼ö ÀÖ´Â Å°¿öµå´Â ´ÙÀ½°ú °°½À´Ï´Ù. (¸ÇÆäÀÌÁö¿¡¼­ ÂüÁ¶ÇÑ ³»¿ëÀÔ´Ï´Ù.) --------------------------------------------------------------------- wait ÇÁ·Î¼¼½º¸¦ ½ÇÇàÇÏ°í, ´ÙÀ½ ÁÙÀÇ ¿£Æ®¸®·Î °¡Áö ¸»°í, ½ÇÇàÇÑ ÇÁ·Î¼¼½º°¡ Á¾·áÇϱâ±îÁö ±â´Ù¸®¶ó´Â ¶æÀÔ´Ï´Ù. respawn ÇÁ·Î¼¼½º¸¦ ½ÇÇàÇÏ°í, ±× ÇÁ·Î¼¼½º°¡ Á×°Ô µÇ¸é, ´Ù½Ã ½ÇÇà½ÃÅ°¶ó´Â ÀÇ ¹ÌÀÔ´Ï´Ù. ÁÖ·Î getty µîÀÇ ÇÁ·Î¼¼½ºÀÔ´Ï´Ù. initdefault µðÆúÆ® ·±·¹º§À» ÁöÁ¤ÇÏ°Ú´Ù´Â ¶æÀÔ´Ï´Ù. À§¿¡ ¿¹½ÃÇÑ inittab ÆÄÀÏ ÀÇ Ã¹ÁÙ¿¡ ÀÌ Å°¿öµå°¡ ³ª¿À´Âµ¥, Çؼ®Çϸé, ·±·¹º§ 3 À» µðÆúÆ® ·± ·¹º§·Î ÁöÁ¤ÇÑ´Ù´Â ÀǹÌÀÔ´Ï´Ù. Áï, initdefault ¿£Æ®¸®´Â ½Ã½ºÅÛÀÇ ºÎÆ® ÇÁ·Î¼¼½º°¡ Á¾·áµÈ ÈÄ¿¡ ÁøÀÔÇÒ ·±·¹º§À» °¡¸®Å°´Â ¿£Æ®¸®ÀÔ´Ï ´Ù. process Çʵå´Â ¾Æ¹«·± Àǹ̰¡ ¾ø°Ô µË´Ï´Ù. off : ¾Æ¹«°Íµµ ÇÏÁö ¸»¶ó´Â ¶æÀÔ´Ï´Ù. once ÀÌ¹Ì ½ÇÇàµÇ°í ÀÖ´Â ÇÁ·Î¼¼½º¶ó¸é ½ÇÇàÇÏÁö ¸»°í, ½ÇÇàµÇ°í ÀÖÁö ¾ÊÀ¸¸é ´ÜÁö Çѹø¸¸ ½ÇÇà½ÃÅ°¶ó´Â ¶æÀÔ´Ï´Ù. ´Ü, wait ó·³ ±â´Ù¸®°Å³ª ÇÏÁö´Â ¾Ê µµ·Ï ÁöÁ¤ÇÕ´Ï´Ù. boot ½Ã½ºÅÛ ºÎÆýÿ¡ ½ÇÇàµÇ¾î¾ß ÇÒ ÇÁ·Î¼¼½º¸¦ °¡¸®Åµ´Ï´Ù. ·±·¹º§ Çʵå´Â ¾Æ¹«·± Àǹ̰¡ ¾ø°Ô µË´Ï´Ù. (¹«½ÃµË´Ï´Ù.) bootwait ÇÁ·Î¼¼½º°¡ ½Ã½ºÅÛ ºÎÆýÿ¡ ½ÇÇàµÇµµ·Ï ÁöÁ¤ÇÕ´Ï´Ù. ´ÜÁö, init °¡ ±× ÇÁ·Î¼¼½º°¡ Á¾·áµÇ±â¸¦ ±â´Ù¸°´Ù´Â Á¡¿¡¼­ boot ¿Í ´Ù¸¨´Ï´Ù. ¿¹¸¦µé¾î /etc/rc ¿Í °°Àº °ÍÀÌ ÀÖ½À´Ï´Ù. sysinit ÇÁ·Î¼¼½º°¡ ½Ã½ºÅÛ ºÎÆ®½Ã¿¡ ½ÇÇàµÇ°Ô ÇÕ´Ï´Ù. ±×¸®°í, ÀÌ ¿£Æ®¸®´Â ´Ù ¸¥ boot ³ª bootwait ¿£Æ®¸®µéÀÌ ½ÇÇàµÇ±â Àü¿¡ ½ÇÇàµÇ´Â ¿£Æ®¸®°¡ µË´Ï´Ù. ·±·¹º§ Çʵå´Â ¹«½ÃÇÕ´Ï´Ù. powerwait init ÇÁ·Î¼¼½º°¡ SIGPWR ½Ã±×³ÎÀ» ¹ÞÀ¸¸é ½ÇÇàµÇ´Â ÇÁ·Î¼¼½ºÀÔ´Ï´Ù. SIGPWR ½Ã±×³ÎÀº Àü¿ø°ú °ü·ÃÇؼ­ ¹«¾ùÀΰ¡ ¹®Á¦°¡ ÀÖÀ½À» °¡¸®Å°´Â ½Ã±×³ÎÀÔ´Ï´Ù. À̶§ init ´Â ÇÁ·Î¼¼½º°¡ Á¾·áµÇ±â±îÁö ´ë±âÇÕ´Ï´Ù. powerfail powerwait Ç׸ñ°ú ¸¶Âù°¡ÁöÀÌÁö¸¸, ÇÁ·Î¼¼½º°¡ Á¾·áµÇ±â±îÁö ±â´Ù¸®Áö ¾Ê´Â´Ù´Â Á¡ÀÌ ´Ù¸¨´Ï´Ù. powerokwait ÀÌ ¿£Æ®¸® ¿ª½Ã init °¡ SIGPWR ½Ã±×³ÎÀ» ¹ÞÀ¸¸é ½ÇÇàµÉ ÇÁ·Î¼¼½º¸¦ ÁöÁ¤ÇÕ´Ï´Ù. ±×·¯³ª, ÀÌ ¿£Æ®¸®¿¡¼­ ÁöÁ¤µÈ ÇÁ·Î¼¼½º´Â /etc/powerstatus ÆÄÀÏ¿¡ OK ¶ó´Â ´Ü¾î°¡ ÀÖÀ» ¶§¸¸ ½ÇÇàµË´Ï´Ù. Áï, Àü¿øÀÌ ´Ù½Ã µ¹¾Æ¿ÔÀ» ¶§¸¸ ½ÇÇàµË´Ï´Ù. ctrlaltdel init °¡ SIGINT ½Ã±×³ÎÀ» ¹Þ°Ô µÇ¸é ½ÇÇàÇÒ ÇÁ·Î¼¼½º¸¦ ÁöÁ¤ÇÕ´Ï´Ù. Áï, ½Ã½ºÅÛ Äֿܼ¡¼­ ´©±º°¡°¡ CTRL-ALT-DEL Å°¸¦ ´­·¶À» ¶§ ÀÌ ¿£Æ® ¸®¿¡¼­ ÁöÁ¤ÇÑ ÇÁ·Î¼¼½º°¡ ½ÇÇàµÇ´Â °ÍÀÔ´Ï´Ù. kbrequest ÀÌ ¿£Æ®¸®¿¡¼­ ÁöÁ¤ÇÏ´Â ÇÁ·Î¼¼½º´Â init °¡ Å°º¸µå Çڵ鷯·ÎºÎÅÍ Äֿܼ¡¼­ Ư¼öÅ° Á¶ÇÕÀÌ ´­·ÁÁ³´Ù´Â ½Ã±×³ÎÀ» ¹ÞÀ¸¸é ½ÇÇàµÇ´Â ÇÁ·Î¼¼ ½ºÀÔ´Ï´Ù. Å°¸Ê ÆÄÀÏ°ú ÇÔ²² ¾²ÀÏ ¼ö ÀÖ½À´Ï´Ù. --------------------------------------------------------------------- ¾Æ¸¶ À§ÀÇ ³»¿ë¸¸ º¸¼Åµµ ÀÚ½ÅÀÇ inittab ÆÄÀÏÀÇ ´ëºÎºÐÀº ÀÌÇØÇÏ½Ç ¼ö ÀÖÀ» °Ì´Ï´Ù. ÀÌÁ¦, ¾µµ¥¾øÀ»Áöµµ ¸ð¸£Áö¸¸, Á¦ inittab ÆÄÀÏÀ» ÇÑÁÙ¾¿ ºÐ¼®ÇØ º¸°Ú½À´Ï´Ù. id:3:initdefault: ÀÌ ÁÙÀº µðÆúÆ® ·±·¹º§À» 3À¸·Î ÁöÁ¤ÇÏ´Â ÁÙÀÔ´Ï´Ù. initdefault Å°¿öµå µÚ¿¡´Â process Çʵ尡 ¹«½ÃµÈ´Ù°í À­ºÎºÐ¿¡¼­ ¼³¸íµÇ¾î ÀÖÁö¿ä? ^^; ÀÌ ÁÙ¿¡ ÀÇÇؼ­ ºÎÆÃÇÑ ÈÄ¿¡ ·±·¹º§ 3 À¸·Î Ä¿³ÎÀÇ ·±·¹º§ÀÌ Á¶Á¤µË´Ï´Ù. ¸¸¾à, óÀ½¿¡ ¸®´ª½º¸¦ ºÎÆÃÇϸé, ¹Ù·Î X ·Î µé¾î°¡½Ã´Â ºÐÀ̶ó¸é À̺κÐÀÌ ´ÙÀ½°ú °°ÀÌ µÇ¾î ÀÖÀ» °Ì´Ï´Ù. id:5:initdefault: ·±·¹º§ 5¿¡ ´ëÇÑ ¼³¸íÀ» inittab ÆÄÀÏ¿¡¼­ º¸½Ê½Ã¿À. X11 À̶ó°í µÇ¾î ÀÖÁö¿ä? ±×·¯¸é, ±× ´ÙÀ½ÁÙÀÔ´Ï´Ù. si::sysinit:/etc/rc.d/rc.sysinit ÀÌ ¶óÀο¡´Â sysinit ¶ó´Â Å°¿öµå°¡ action Çʵ忡 ÁöÁ¤µÇ¾ú½À´Ï´Ù. action Çʵ忡 ÁöÁ¤ÇÒ ¼ö ÀÖ´Â Å°¿öµå Áß sysinit ¸¦ ã¾Æº¸¸é, ÇÁ·Î¼¼½º°¡ ½Ã½ºÅÛ ºÎÆýÿ¡ ½ÇÇàµÇ¸ç, ·±·¹º§Àº ¹«½ÃÇÑ´Ù´Â ³»¿ë°ú, ´Ù¸¥ boot ³ª bootwait °¡ action Çʵ忡 ÁöÁ¤µÈ ÇÁ·Î¼¼½ºµéº¸´Ù ¸ÕÀú ½ÇÇàµÈ´Ù´Â ³»¿ëÀÌ ÀÖ½À´Ï´Ù. Áï, Á¦ÀÏ Ã³À½ init ÇÁ·Î¼¼½º°¡ ½ÇÇà½ÃÅ°´Â ¸í·ÉÀÔ´Ï´Ù. Á¤È®È÷ ¸»Çϸé, start-up ½ºÅ©¸³Æ®¶ó°í ÇÒ ¼ö ÀÖ½À´Ï´Ù. process Çʵ忡 /etc/rc.d/rc.sysinit ¶ó°í ¸í½ÃµÇ¾î ÀÖ½À´Ï´Ù. ´Ù½ÃÇѹø ´Ü¼øÈ­½ÃÄѼ­ À̾߱âÇϸé, À§¿¡ ¿¹½ÃÇÑ inittab ÆÄÀÏÀ» »ç¿ëÇÏ´Â Á¦ ¸®´ª½º ¹Ú½º´Â Àü¿øÀ» ¿Ã¸®¸é, /etc/rc.d/rc.sysinit °¡ ½ÇÇàµÈ´Ù´Â °ÍÀÔ´Ï´Ù. rc.sysinit ÀÇ ³»¿ëÀº ³ªÁß¿¡ »ìÆ캸±â·Î ÇÏ°í, ´ÙÀ½ÁÙ·Î ÁøÇàÇÏ°Ú½À´Ï´Ù. l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6 º¸½Ã°í, ÁüÀÛÇϽŠ¹Ù¿Í °°ÀÌ °¢ ·±·¹º§º°·Î ÁöÁ¤µÈ ½ÃÀÛ ½ºÅ©¸³Æ®µéÀÔ´Ï´Ù. /etc/rc.d/rc ½ºÅ©¸³Æ®¿¡ ÇØ´ç ·±·¹º§À» Àμö·Î ³Ñ°ÜÁִ±º¿ä. /etc/rc.d/rc ½ºÅ©¸³Æ®ÀÇ ³»¿ëÀº ³ªÁß¿¡ Çϳª¾¿ ºÐ¼®ÇØ º¸°Ú½À´Ï´Ù. °¢ ·±·¹º§ º°·Î ÁöÁ¤µÈ ½ºÅ©¸³Æ®´Â ±× ½ÇÇàÀÌ Á¾·áµÉ ¶§±îÁö init ÇÁ·Î¼¼½º°¡ ÁøÇàÇÏÁö ¾Ê°í, ±â´Ù¸®¶ó´Â ÀǹÌÀÇ wait Å°¿öµå¸¦ action Çʵ忡 ÁöÁ¤ÇØ µÎ¾ú±º¿ä. ud::once:/sbin/update ±× ´ÙÀ½ÁÙ¿¡´Â action Çʵ忡 once Å°¿öµå°¡ ¾²¿´½À´Ï´Ù. ±×·¡¼­ °¢ ·±·¹º§º°·Î Çѹø¾¿¸¸ ½ÇÇàµÇ´Â ÇÁ·Î¼¼½ºÀÔ´Ï´Ù. /sbin/update ¸¦ ½ÇÇàÇϴ±º¿ä. /sbin/update ´Â bdflush ¶ó´Â Ä¿³Î µ¥¸óÀ» ½ÇÇà½Ãŵ´Ï´Ù. ÀÌ µ¥¸óÀº ¹öÆÛ¸¦ °»½ÅÇÑ´ÙµçÁö ÇÏ´Â ÀÏÀ» ÇÕ´Ï´Ù. ÀÚ¼¼ÇÑ ³»¿ëÀº man update ¸¦ ÇØ º¸½Ã¸é ¾Ë ¼ö ÀÖ½À´Ï´Ù. ca::ctrlaltdel:/sbin/shutdown -t3 -r now ±× ´ÙÀ½À¸·Î ³ª¿À´Â °ÍÀº »ç¿ëÀÚ°¡ Äֿܼ¡¼­ CTRL-ALT-DEL Å°ÀÇ Á¶ÇÕÀ» ´­·Á¼­ ½Ì±Û À¯Àú¸ðµå·Î µé¾î°¡°Å³ª ȤÀº ½Ã½ºÅÛÀ» ¼Ë´Ù¿î ÇÏ·Á°í ÇÒ ¶§ ºÒ·ÁÁö´Â ÇÁ·Î¼¼½º¸¦ Á¤ÀÇÇÕ´Ï´Ù. /sbin/shutdown -t3 -r now ·Î Á¤ÀÇÇß±º¿ä. 3ÃÊ ÈÄ¿¡ ÀçºÎÆÃÇÏ°Ô µË´Ï´Ù. shutdown ÀÌ ÀçºÎÆÃÀ» ¼öÇàÇϱâ À§Çؼ­´Â init ÇÁ·Î¼¼½º¿¡°Ô ·±·¹º§À» ¹Ù²Ùµµ·Ï Ç϶ó´Â ½Ã±×³ÎÀ» º¸³»°Ô µË´Ï´Ù. ·±·¹º§ 0Àº ½Ã½ºÅÛ halt ¿¡ »ç¿ëµÇ°í, ·±·¹º§ 6Àº Àç½ÃÀÛ, 1Àº ½Ì±ÛÀ¯Àú ¸ðµå¿¡ »ç¿ëµË´Ï´Ù. Àç¹ÌÀÖ´Â °ÍÀ¸·Î, »ç¿ëÀÚ°¡ (root »ç¿ëÀÚÀÏ °æ¿ì) init ÇÁ·Î¼¼½º¿¡°Ô ±¸Ã¼ÀûÀ¸·Î ¾î¶² ·±·¹º§¿¡¼­ init ¸¦ ¼öÇà½ÃųÁö Ä¿¸Çµå¶óÀο¡¼­ ¸í½ÃÇØ ÁÙ ¼ö ÀÖ½À´Ï´Ù. /sbin/init N À̶ó°í ¸í·ÉÀ» ³»¸®¸é, N ¿¡ ¸í½ÃµÈ ½ÇÇà·¹º§·Î init °¡ ÁøÀÔÇÏ°Ô µË´Ï´Ù. /sbin/init 6 À̶ó°í Çϸé, init ´Â ·±·¹º§ 6 À¸·Î ÁøÀÔÇÏ°Ô µÇ¸é¼­ ½Ã½ºÅÛÀº ÀçºÎÆà µÇ°Ô µË´Ï´Ù. ´Ù¸¥ System V °è¿­ÀÇ ¿î¿µÃ¼Á¦¿¡¼­´Â ÀÌ·¯ÇÑ °æ¿ì¸¦ À§Çؼ­ Ưº°È÷ telinit ¶ó´Â ¸í·É¾îµµ ÁغñÇØ ³õ°í ÀÖ½À´Ï´Ù. (¸®´ª½ºµµ ¸¶Âù°¡ÁöÀÔ´Ï´Ù.) pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" ´ÙÀ½ µÎÁÙÀº Àü¿ø¿¡ °ü°èµÈ °ÍÀ¸·Î, UPS ¸¦ »ç¿ëÇÏ´Â ºÐµé¿¡°Ô¸¸ ÇØ´çµÇ´Â°Å °°±º¿ä. 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6 ±×¸®°í, °ÅÀÇ ¸¶Áö¸· ºÎºÐ¿¡ ºÙ¾î ÀÖ´Â ¿©¼¸ÁÙ, ÀÌ ÁÙÀº °¢ ·±·¹º§ 2,3,4,5 ÀÏ ¶§ ½ÇÇàµÇ´Â °ÍÀ¸·Î½á, ÄܼÖÀ» ¿­°í, ÀÀ´äÀ» ±â´Ù¸®´Â ºÎºÐÀÔ´Ï´Ù. ¾Õ¼­ÀÇ ¸ðµç ÃʱâÈ­ °úÁ¤ÀÌ ³¡³ª°í ¸¶Áö¸·À¸·Î ½ÇÇàµÇ´Â ºÎºÐÀÌÁÒ. ÄÄÀ» Ä×À» ¶§ ¹Ù·Î X °¡ ½ÃÀ۵Ǵ ºÐµéÀº x:5:respawn:/etc/X11/prefdm -nodaemon µî°ú °°ÀÌ ·±·¹º§ 5¿¡¸¸ ÇØ´çµÇ´Â ·Î±×¿Â ÇÁ·Î¼¼½º°¡ ¸í½ÃµÇ¾î ÀÖÀ» °Ì´Ï´Ù. -------------------------------------------------------------------- 3. init : ±× ÀÌÈÄ -------------------------------------------------------------------- ¾Õ Àý¿¡¼­ ¼³¸íÇÑ ¹Ù¿Í °°ÀÌ init ÇÁ·Î¼¼½º°¡ Àڽſ¡°Ô ÇÒ´çµÈ ÃʱâÈ­ °úÁ¤À» ¸ðµÎ ³¡¸¶Ä¡°í ³ª¸é, inittab ÆÄÀÏÀÇ ¸Ç ³¡ºÎºÐ¿¡ ¸í½ÃµÈ °Íó·³ mingetty ȤÀº getty ÇÁ·Î¼¼½º¸¦ ½ÇÇà½Ãŵ´Ï´Ù. ½ÇÇà½ÃÅ°´Â ¹æ¹ýÀº ÃÖÃÊ¿¡ pid 0 ÀÇ ÇÁ·Î¼¼½º¿¡ ÀÇÇØ ½ÇÇàµÈ "¿Õ"(?) init °¡ fork() ½Ã½ºÅÛ ÄÝÀ» Çѹø ¼öÇàÇÏ°í, ±×¿¡ ÀÇÇØ »ý¼ºµÈ ÀÚ½Ä init °¡ exec() ½Ã½ºÅÛ ÄÝÀ» ÀÌ¿ëÇؼ­ mingetty µîÀÇ ÇÁ·Î¼¼½º¸¦ ¼öÇàÇÏ°Ô µË´Ï´Ù. ±×¸®°í ³ª¼­, mingetty ÇÁ·Î¼¼½º´Â ´Ù½Ã exec() ¸¦ È£ÃâÇÏ¿© login ÇÁ·Î¼¼½º¸¦ ¼öÇàÇÏ°í, login ÇÁ·Î¼¼½º´Â »ç¿ëÀÚÀÇ userid ¿Í passwd ¸¦ ÀԷ¹޾Ƽ­ »ç¿ëÀÚ ÀÎÁõ°úÁ¤À» °ÅĨ´Ï´Ù. ¸¸¾à, ½ÂÀÎµÈ »ç¿ëÀÚ¶ó¸é, /etc/passwd ÆÄÀÏ¿¡ ¸í½ÃµÈ »ç¿ëÀÚ¿¡ ÇØ´çÇÏ´Â ½©À» ¶ç¿ì°Ô µË´Ï´Ù. ½©À» ¶ç¿ì´Â °Í ¶ÇÇÑ exec() ½Ã½ºÅÛ ÄÝÀ» ÀÌ¿ëÇؼ­ ÀÔ´Ï´Ù. ±×·¯¸é, »ç¿ëÀÚ´Â ÀÚ½ÅÀÇ ½© (ÁÖ·Î bash) ·Î ÀÛ¾÷À» ÇÏ°í, ½©¿¡¼­ ÀÔ·ÂÇÏ´Â ¸í·É¾îµéÀº ¸ÕÀú ½©ÀÌ fork() ¸¦ ÇÑ ÈÄ ½©ÀÇ ÀÚ½ÄÇÁ·Î¼¼½º°¡ exec() ¸¦ ÇÏ¿© ½ÇÇàµÇ°í, Á¾·áÇÏ´Â °ÍÀÔ´Ï´Ù. ÀÌ °úÁ¤À» °£´ÜÇÏ°Ô ±×¸²À¸·Î ±×¸®¸é ´ÙÀ½°ú °°½À´Ï´Ù. +-------------+ | "¿Õ" init | | (pid 1) | +------+------+ | <-------------------------------------+ | fork() | respawn \|/ | +------+------+ | | "ÀÚ½Ä" init | | | (pid 266) | | +------+------+ | | | | exec() | \|/ | +------+------+ | | mingetty | | | (pid 266) | | +------+------+ | | | | exec() | \|/ | +------+------+ | | login | | | (pid 266) | | +------+------+ | | | | exec() | \|/ | +------+------+ | | bash +---------------------------- ½© Á¾·á | (pid 266) | ·Î±×¾Æ¿ô +------+------+ | ¸í·É¾î ¼öÇà | fork() \|/ +------+------+ | bash | | (pid5909) | +------+------+ | | exec() \|/ +------+------+ |´Ù¸¥ ÇÁ·Î¼¼½º| | (pid5909) | +------+------+ -------------------------------------------------------------------- 4. /etc/rc.d/rc.sysinit, /etc/rc.d/rc -------------------------------------------------------------------- rc.sysinit ½ºÅ©¸³Æ®´Â »ìÆ캻 °á°ú Å©°Ô ƯÀÌÇÒ °ÍÀº ¾ø´Â °Í °°½À´Ï´Ù. ÇÏ´Â ÀϵéÀº ·¹µåÇÞ ±â¹Ý ¹èÆ÷º»À» ¸ðµ¨·Î ¼³¸íÇÏ°Ú½À´Ï´Ù. ÀÌ ÆÄÀÏÀº inittab ÀÇ Á¤ÀÇ¿¡ µû¶ó, ½Ã½ºÅÛ ÃʱâÈ­½Ã ¸Ç ¸ÕÀú µü ÇÑ ¹ø ½ÇÇàµÇ´Â ÃʱâÈ­ ½ºÅ©¸³Æ®ÀÔ´Ï´Ù. - ±âº»ÀûÀÎ path ¼³Á¤ - /etc/sysconfig/network ÆÄÀÏÀÌ ÀÖÀ¸¸é ±× ½ºÅ©¸³Æ®¸¦ ½ÇÇà½ÃÅ´ - Å°¸ÊÀÇ ·Îµù - ½Ã½ºÅÛ ÆùÆ®ÀÇ ·Îµù - ½º¿Ò ¿µ¿ªÀÇ È°¼ºÈ­ - µð½ºÅ© °Ë»ç (fsck) - /proc ÆÄÀϽýºÅÛÀÇ ¸¶¿îÆ® - ·çÆ® ÆÄÀϽýºÅÛÀ» rw ¸ðµå·Î ´Ù½Ã ¸¶¿îÆ®Çϱâ - /etc/HOSTNAME ÆÄÀÏÀÇ ¼³Á¤ - /etc/mtab ÆÄÀÏ¿¡ ·çÆ®¿Í /proc ÆÄÀϽýºÅÛÀÇ ¿£Æ®¸® Ãß°¡Çϱâ - Ä¿³Î ¸ðµâµé ·ÎµåÇϱâ - ½Ã½ºÅÛ ½Ã°£ ¼³Á¤ - µîµî.... ÀÇ ÀÏÀ» ¼öÇàÇÕ´Ï´Ù. ÀÚ¼¼ÇÑ °ÍÀº rc.sysinit ÆÄÀÏÀ» ÂùÂùÈ÷ ÀÐ¾î º¸¸é ¾Ë ¼ö ÀÖ½À´Ï´Ù. Á¤ÀÛ, ¿ì¸®°¡ ÁÖÀǸ¦ ±â¿ïÀÏ ÃʱâÈ­ ½ºÅ©¸³Æ®´Â °¢Á¾ µ¥¸óµéÀ» ½ÇÇà½ÃÅ°°í, Á×À̴µ¥ »ç¿ëµÇ´Â /etc/rc.d/rc ½ºÅ©¸³Æ®ÀÔ´Ï´Ù. ÀÌ ½ºÅ©¸³Æ®´Â Àμö·Î ½ÇÇà ·¹º§À» ¹Þ½À´Ï´Ù.(-_-; Ç¥ÇöÀÌ Á» ¸Å²ô·´Áö ¸øÇϱº¿ä) Áï, /etc/rc.d/rc n °ú °°Àº Çü½ÄÀ¸·Î ½ÇÇà½Ãŵ´Ï´Ù. n ¿¡´Â ½ÇÇà·¹º§ÀÌ µé¾î°©´Ï´Ù. Á» ´õ ³ªÀº ÀÌÇظ¦ À§Çؼ­ ´ÙÀ½ÀÇ ¸í·ÉÀ» ½ÇÇà½ÃÄÑ º¸½Ê½Ã¿À. ls /etc/rc.d ½ÇÇà °á°ú·Î /etc/rc.d µð·ºÅ丮ÀÇ ³»¿ëÀÌ ³ª¿À´Âµ¥, ±× Áß¿¡ ´ÙÀ½°ú °°Àº µð·ºÅ丮µéÀÌ ÀÖ½À´Ï´Ù. rc0.d/ rc1.d/ rc2.d/ rc3.d/ rc4.d/ rc5.d/ rc6.d/ °¢°¢ÀÇ µð·ºÅ丮´Â rc·±·¹º§.d ·Î À̸§ÀÌ Áö¾îÁ® ÀÖ½À´Ï´Ù. °¢ µð·ºÅ丮 ¾Æ·¡¿¡´Â ÇØ´ç ·±·¹º§¿¡¼­ ½ÇÇàÇÒ ¼­ºñ½º³ª ÇÁ·Î¼¼½ºµéÀÌ Á¤ÀǵǾî ÀÖ½À´Ï´Ù. ÇÑ µð·ºÅ丮¸¦ Á¤Çؼ­ ¾î¶² ÆÄÀϵéÀÌ ÀÖ´ÂÁö »ìÆ캸°Ú½À´Ï´Ù. $ ll /etc/rc.d/rc3.d drwxr-xr-x ./ drwxr-xr-x ../ lrwxrwxrwx K05keytable -> ../init.d/keytable* lrwxrwxrwx K15gpm -> ../init.d/gpm* lrwxrwxrwx K15proftpd -> ../init.d/proftpd* lrwxrwxrwx K60atd -> ../init.d/atd* lrwxrwxrwx K60crond -> ../init.d/crond* lrwxrwxrwx K80random -> ../init.d/random* lrwxrwxrwx K89portmap -> ../init.d/portmap* lrwxrwxrwx K92apmd -> ../init.d/apmd* lrwxrwxrwx K96pcmcia -> ../init.d/pcmcia* lrwxrwxrwx S10network -> ../init.d/network* lrwxrwxrwx S30syslog -> ../init.d/syslog* lrwxrwxrwx S50inet -> ../init.d/inet* lrwxrwxrwx S55named -> ../init.d/named* lrwxrwxrwx S80sendmail -> ../init.d/sendmail* lrwxrwxrwx S90mysql -> ../init.d/mysql* lrwxrwxrwx S91smb -> /etc/rc.d/init.d/smb* lrwxrwxrwx S99local -> ../rc.local* º¸½Ã´Â ¹Ù¿Í °°ÀÌ S ·Î ½ÃÀÛÇÏ´Â ÆÄÀϵé°ú, K ·Î ½ÃÀÛÇÏ´Â ÆÄÀϵéÀÌ ÁÖ¿í~ Àִµ¥, °ÅÀÇ /etc/rc.d/init.d ¾Æ·¡ÀÇ ÆÄÀϵ鿡 ¸µÅ©°¡ µÇ¾î ÀÖ½À´Ï´Ù. ÀÌó·³, rcN.d µð·ºÅ丮ÀÇ ¸ðµç ÆÄÀϵéÀº ¿À·ÎÁö ¸µÅ©·Î¸¸ µÇ¾î ÀÖÀ¸¸ç, ½ÇÁ¦ ¼­ºñ½º¸¦ ½ÃÀÛÇϰųª Á¾·áÇÏ´Â ½ºÅ©¸³Æ®´Â /etc/rc.d/init.d µð·ºÅ丮 ¾Æ·¡¿¡ Á¸ÀçÇÕ´Ï´Ù. S ·Î ½ÃÀÛÇÏ´Â ÆÄÀÏÀº ÇØ´ç ¼­ºñ½º¸¦ ½ÇÇà½ÃÅ°´Âµ¥ »ç¿ëµÇ°í, (Start) K ·Î ½ÃÀÛÇÏ´Â ÆÄÀÏÀº ÇØ´ç ¼­ºñ½º¸¦ Á×À̴µ¥ »ç¿ëµË´Ï´Ù.(Kill) Á¦ ÄÄÇ»ÅÍ¿¡¼­´Â µðÆúÆ® ·±·¹º§ÀÎ 3 ¿¡¼­ network, syslog, inet, named, sendmail, mysql, smb µîÀ» ½ÇÇàÇϵµ·Ï ±¸¼ºÇØ µÎ¾ú½À´Ï´Ù. (¾ÆÆÄÄ¡¿Í proftpdµµ ½ÇÇàÀÌ µÇ´Âµ¥, ÀÏÀÏÀÌ ¸µÅ© °É±â°¡ ±ÍÂú(^^;)¾Æ¼­ S99local ÀÌ °¡¸®Å°´Â /etc/rc.d/rc.local ¾È¿¡ ½ÃÀÛ ½ºÅ©¸³Æ®¸¦ Àû¾î µÎ¾ú½À´Ï´Ù.) ±×·³ Àç¹Ì»ï¾Æ¼­, /etc/rc.d/rc0.d µð·ºÅ丮ÀÇ ³»¿ëµµ »ìÆì º¸°Ú½À´Ï´Ù. $ ll /etc/rc.d/rc0.d drwxr-xr-x ./ drwxr-xr-x ../ lrwxrwxrwx K05keytable -> ../init.d/keytable* lrwxrwxrwx K15gpm -> ../init.d/gpm* lrwxrwxrwx K15proftpd -> ../init.d/proftpd* lrwxrwxrwx K30sendmail -> ../init.d/sendmail* lrwxrwxrwx K45named -> ../init.d/named* lrwxrwxrwx K50inet -> ../init.d/inet* lrwxrwxrwx K60atd -> ../init.d/atd* lrwxrwxrwx K60crond -> ../init.d/crond* lrwxrwxrwx K80random -> ../init.d/random* lrwxrwxrwx K85netfs -> ../init.d/netfs* lrwxrwxrwx K89portmap -> ../init.d/portmap* lrwxrwxrwx K90killall -> ../init.d/killall* lrwxrwxrwx K90mysql -> ../init.d/mysql* lrwxrwxrwx K90network -> ../init.d/network* lrwxrwxrwx K92apmd -> ../init.d/apmd* lrwxrwxrwx K96pcmcia -> ../init.d/pcmcia* lrwxrwxrwx K99syslog -> ../init.d/syslog* lrwxrwxrwx S00halt -> ../init.d/halt* ¿¹»óÇß´ø ´ë·Î °ÅÀÇ ¸ðµÎ°¡ K ·Î ½ÃÀÛÇÏ´Â ¸µÅ©¸¸ Á¸ÀçÇÕ´Ï´Ù. ´Ü Çϳª S ·Î ½ÃÀÛÇÏ´Â ¸µÅ©´Â halt ÀÔ´Ï´Ù. ½Ã½ºÅÛ Á¾·á¸¦ ÇÏ´Â ½ºÅ©¸³Æ®¿¡ ¸µÅ©°¡ °É·Á ÀÖ½À´Ï´Ù. ÀÌÁ¦, ÀÌ·¸°Ô ½ÇÇà·¹º§ º°·Î ÀûÀýÇÑ µð·ºÅ丮¸¦ ã¾Æ¼­ ±× µð·ºÅ丮 ¾Æ·¡ÀÇ ¸µÅ©°¡ °¡¸®Å°´Â ½ºÅ©¸³Æ®µéÀ» ½ÇÇà½ÃÅ°´Â ½ºÅ©¸³Æ®ÀÎ /etc/rc.d/rc ¸¦ »ìÆ캸°Ú½À´Ï´Ù. ¾Æ·¡¿¡ Á¦ ÄÄÇ»ÅÍÀÇ /etc/rc.d/rc ÆÄÀÏÀÇ ÀϺθ¦ ¹ßÃéÇØ º¸¾Ò½À´Ï´Ù. ·¹µåÇÞ ÀνºÅçÇÑ ÈÄ¿¡ Çϳªµµ ¹Ù²ÙÁö ¾Ê¾Ò½À´Ï´Ù. (^^;) -------------------------------------------------------------------- #!/bin/bash # # rc This file is responsible for starting/stopping # services when the runlevel changes. It is also # responsible for the very first setup of basic # things, such as setting the hostname. # # Original Author: # Miquel van Smoorenburg, # # Source function library. . /etc/rc.d/init.d/functions ... »ý·« ... # ¸¸¾à, ù¹ø° ÀÎÀÚ·Î ³Ñ¾î¿Â ·±·¹º§¿¡ ÇØ´çÇÏ´Â µð·ºÅ丮°¡ ÀÖ´Ù¸é, ¿ì¼±, # Áö±Ý ½ÇÇàÁßÀÎ ÇÁ·Î¼¼½º¸¦ Á×ÀÔ´Ï´Ù. # ÇÁ·Î¼¼½º¸¦ Á×ÀÌ´Â µ¥ »ç¿ëµÇ´Â ¸í·É¾î´Â K ¶ó´Â Á¢µÎ¾î°¡ ºÙÀº ÆÄÀÏÀÔ´Ï´Ù. # ·±·¹º§¿¡ ÇØ´çÇÏ´Â µð·ºÅ丮´Â /etc/rc.d/rcn.d ·Î½á, n ¿¡´Â 0, 1, 2, 3, 4, # 5, 6µî ·±·¹º§ÀÇ ¼ýÀÚ°¡ ºÙ½À´Ï´Ù. ls /etc/rc.d ¸¦ ½ÇÇàÇØ º¸½Ã¸é rc0.d # rc1.d... ¿Í °°Àº µð·ºÅ丮µéÀÌ Á¸ÀçÇÏ´Â °ÍÀ» º¼ ¼ö ÀÖ½À´Ï´Ù. if [ -d /etc/rc.d/rc$runlevel.d ]; then # ¸ÕÀú, kill ½ºÅ©¸³Æ®¸¦ ½ÇÇà½ÃŲ´Ù. for i in /etc/rc.d/rc$runlevel.d/K*; do # ½ºÅ©¸³Æ®°¡ Á¸ÀçÇÏ´ÂÁö üũÇÑ´Ù. [ ! -f $i ] && continue # [KS]??foo.{rpmsave,rpmorig} ½ºÅ©¸³Æ®¸¦ ½ÇÇà½ÃÅ°Áö ¾Ê´Â´Ù. # [KS]??foo.{rpmsave,rpmorig} ÀÇ ¶æÀº... Á¤±ÔÇ¥Çö½ÄÀ» Á¶±Ý °øºÎÇØ # º¸¸é ¾Ë ¼ö ÀÖ´Ù. # ù ±ÛÀÚ°¡ K ȤÀº S ·Î ½ÃÀÛÇϸç, ±× µÚ¿¡ ÀÓÀÇÀÇ ¹®ÀÚ µÎ°³°¡ ¿À°í, # ±× µÚ¿¡ foo. ÀÌ ¿À¸ç, ³¡¿¡ rpmsave ³ª rpmorig °¡ ºÙÀº ÇüÅÂÀÇ ÆÄÀÏ # À̸§À» ¶æÇÑ´Ù. [ "${i%.rpmsave}" != "${i}" ] && continue [ "${i%.rpmorig}" != "${i}" ] && continue [ "${i%.rpmnew}" != "${i}" ] && continue # Check if the subsystem is already up. subsys=${i#/etc/rc.d/rc$runlevel.d/K??} [ ! -f /var/lock/subsys/$subsys ] && \ [ ! -f /var/lock/subsys/${subsys}.init ] && continue # Bring the subsystem down. if egrep -q "(killproc |action )" $i ; then $i stop else action "Stopping $subsys" $i stop fi done # ÇÁ·Î¼¼½º¸¦ ¸ðµÎ Á׿´´Ù¸é, ÀÌÁ¦, ÇØ´ç ·±·¹º§¿¡¼­ ½ÇÇàµÇ¾î¾ß ÇÏ´Â # ÇÁ·Î¼¼½ºµéÀ» ½ÇÇà½Ãų Â÷·ÊÀÔ´Ï´Ù. ÇÁ·Î¼¼½º¸¦ ½ÇÇàÇÏ´Â ¸í·É¾î´Â S ¶ó´Â # Á¢µÎ¾î°¡ ºÙÀº ÆÄÀÏÀÔ´Ï´Ù. for i in /etc/rc.d/rc$runlevel.d/S*; do # ½ºÅ©¸³Æ®°¡ Á¸ÀçÇÏ´ÂÁö È®ÀÎÇÑ´Ù. [ ! -f $i ] && continue # Don't run [KS]??foo.{rpmsave,rpmorig} scripts [ "${i%.rpmsave}" != "${i}" ] && continue [ "${i%.rpmorig}" != "${i}" ] && continue [ "${i%.rpmnew}" != "${i}" ] && continue # Check if the subsystem is already up. subsys=${i#/etc/rc.d/rc$runlevel.d/S??} [ -f /var/lock/subsys/$subsys ] || \ [ -f /var/lock/subsys/${subsys}.init ] && continue # ¼­ºñ½º¸¦ ½ÇÇà½ÃųÁö ½ÇÇà ½ÃÅ°Áö ¾ÊÀ»Áö¸¦ »ç¿ëÀÚ¿¡°Ô ¹°¾îº¸´Â # "confirm" ¸ðµåÀÎÁö¸¦ È®ÀÎÇÑ´Ù. ¸¸¾à confirm ¸ðµåÀ̸é, »ç¿ëÀÚ¿¡°Ô # ÇØ´ç ÇÁ·Î¼¼½ºÀÇ ½ÇÇà ¿©ºÎ¸¦ ÁúÀÇÇÑ´Ù. # confirm ÇÔ¼ö´Â /etc/rc.d/init.d/functions ¿¡ Á¤ÀǵǾî ÀÖ´Ù. [ -n "$CONFIRM" ] && { confirm $subsys case $? in 0) : ;; 2) CONFIRM= ;; *) continue ;; esac } # Bring the subsystem up. if egrep -q "(daemon |action )" $i ; then $i start else if [ "$subsys" = "halt" -o "$subsys" = "reboot" -o \ "$subsys" = "single" ]; then $i start else action "Starting $subsys" $i start fi fi done fi -------------------------------------------------------------------- ¼¼ºÎÀûÀÎ ³»¿ëÀº ½ºÅ©¸³Æ®¸¦ Â÷ºÐÈ÷ ºÐ¼®ÇØ º¸½Ã¸é ¾Æ½Ç ¼ö ÀÖÀ» °ÍÀÔ´Ï´Ù. ¿©±â¼­ Áß¿äÇÑ °ÍÀº, ÀÚ½ÅÀÌ ºÎÆýÿ¡ ½ÇÇà½ÃÅ°±â¸¦ ¿øÇÏ´Â µ¥¸óÀ» ÁöÁ¤ÇÒ ¼ö ÀÖ´Ù´Â °ÍÀÔ´Ï´Ù. rc ½ºÅ©¸³Æ®¿¡ º¸¸é, rc ¿¡ Àμö·Î °Ç³×Áø ·±·¹º§ÀÇ ¼ýÀÚ¸¦ º¸°í, ÇØ´çÇÏ´Â µð·ºÅ丮¿¡¼­ K ·Î ½ÃÀÛÇϰųª, S ·Î ½ÃÀÛÇÏ´Â ¸ðµç ÆÄÀÏÀ» ã¾Æ¼­ Á×À̰ųª ½ÇÇà½Ãŵ´Ï´Ù. for i in /etc/rc.d/rc$runlevel.d/K*; do .... $i stop °ú for i in /etc/rc.d/rc$runlevel.d/S*; do .... $i start ºÎºÐÀÌ ±× ÀÏÀ» ÇÏ°Ô µË´Ï´Ù. ¿ì¸®°¡ ´ÙÁß »ç¿ëÀÚ ¸ðµå·Î ºÎÆÃÇßÀ» ¶§, Áï, ÄÄÇ»Å͸¦ Ä×À» ¶§ ÀÚµ¿À¸·Î ½ÇÇà½ÃÅ°°íÀÚ ÇÏ´Â µ¥¸ó Áß¿¡, ¿¹¸¦µé¾î, httpd °¡ ÀÖ´Ù°í °¡Á¤Çϸé, httpd °¡ ÄÄÀ» Ä×À» ¶§ ÀÚµ¿À¸·Î ½ÇÇàµÇ°Ô Çϱâ À§Çؼ­ /etc/rc.d/rc3.d µð·ºÅ丮 ¾Æ·¡¿¡ SNNhttpd ¶ó´Â ÆÄÀÏ°ú KNNhttpd ÆÄÀÏÀ» ½Éº¼¸¯ ¸µÅ©·Î httpd ȤÀº apachectl ¿¡ ¸µÅ©½ÃÄÑ ÁÖ¸é µÇ´Â °ÍÀÔ´Ï´Ù. ±×·¯¸é, ºÎÆýÿ¡ ·±·¹º§ 3À¸·Î ÁøÀÔÇϸ鼭, /etc/rc.d/rc3.d µð·ºÅ丮ÀÇ S* ÆÄÀϵéÀ» ½ÇÇàÇÏ°Ô µÇ°í, (S µÚ¿¡ ¹øÈ£°¡ Àִµ¥ ±× ¼ø¼­·Î ½ÇÇàµË´Ï´Ù.) ¿ì¸®°¡ ¸¸µç SNNhttpd ¸µÅ©µµ ½ÇÇàÇÏ°Ô µË´Ï´Ù. (¿©±â¼­ NN Àº ÀûÀýÇÑ ¹øÈ£ÀÔ´Ï´Ù. ³×Æ®¿öÅ©°¡ È°¼ºÈ­ µÈ ÈÄ¿¡ apache µ¥¸óÀÌ ½ÇÇàµÇ¾î¾ß Çϴ°ÍÀ» °í·ÁÇØ ÀûÀýÇÏ°Ô ¹øÈ£¸¦ ÇÒ´çÇØ ÁÖ½Ã¸é µË´Ï´Ù. Âü°íÇÒ ºÎºÐÀº, ÇØ´ç ÇÁ·Î¼¼½º¸¦ ½ÇÇà½ÃÅ°°Å³ª Á¾·á½ÃÅ°´Â ½ºÅ©¸³Æ®´Â ¹Ýµå½Ã, Ç×»ó, Àμö·Î start ȤÀº stop À̶ó´Â °ÍÀ» ³Ñ°Ü ¹Þµµ·Ï ÀÛ¼ºÇØ¾ß ÇÑ´Ù´Â °ÍÀÔ´Ï´Ù. ¸¸¾à ¿©·¯ºÐÀÌ ÇØ´ç ÇÁ·Î¼¼½º¸¦ ½ÇÇà ȤÀº Á¾·á½ÃÅ°´Â ½ºÅ©¸³Æ®¸¦ Á÷Á¢ ¸¸µé±â¸¦ ¿øÇϽŴٸé, ´ÙÀ½°ú °°Àº Äڵ尡 ¹Ýµå½Ã Æ÷ÇԵǾ /etc/rc.d/rc ½ºÅ©¸³Æ®¿¡¼­ ½ÇÇàÇÒ ¼ö ÀÖµµ·Ï ÀÛ¼ºÀ» ÇÏ¼Å¾ß ÇÕ´Ï´Ù. ±×¸®°í, ½Ã½ºÅÛ °ü¸®»ó, ÀÏ°ü¼º ÀÖ°Ô, ±× ½ºÅ©¸³Æ®´Â /etc/rc.d/init.d ¿¡ ³Ö¾î Áֽô°ÍÀÌ º¸±â¿¡ ÁÁÀ» °Í °°½À´Ï´Ù. . /etc/rc.d/init.d/functions ... Áß·« ... case "$1" in start) # ÀÌ ºÎºÐ¿¡ ½ÃÀÛÇÏ´Â Äڵ带 ³Ö´Â´Ù. ;; stop) # ÀÌ ºÎºÐ¿¡ Á¾·áÇÏ´Â Äڵ带 ³Ö´Â´Ù. ;; *) # ¸¸¾à start ȤÀº stop ÀÌ ¸í½ÃµÇÁö ¾ÊÀ¸¸é ´ÙÀ½ÁÙÀ» ½ÇÇàÇÑ´Ù. echo "Usage: skeleton {start|stop}" exit 1 esac exit 0 ÀÌ°Ô Á» º¹ÀâÇÏ´Ù°í ´À³¢½Ã´Â ºÐµéÀº /etc/rc.d/rc.local ½ºÅ©¸³Æ®°¡ Àִµ¥, ÀÌ ½ºÅ©¸³Æ® ¸¶Áö¸· ºÎºÐ¿¡ ½ÇÇà½ÃÅ°±â¸¦ ¿øÇÏ´Â µ¥¸óÀ» ½ÇÇàÇÏ´Â Äڵ带 ³Ö¾î ÁÖ½Ã¸é µË´Ï´Ù. ´Ü, rc.local ½ºÅ©¸³Æ®´Â ½ÇÇà·¹º§ 2, 3, 5 ÀÏ ¶§¸¸ ½ÇÇàµÇµµ·Ï ¼³Á¤µÇ¾î ÀÖ½À´Ï´Ù. rc.local ½ºÅ©¸³Æ®´Â rcN.d µð·ºÅ丮¿¡¼­ S99local À̶ó´Â À̸§À¸·Î ¸µÅ©µÇ¾î ½ÇÇàµË´Ï´Ù. S99local À̶ó´Â ÆÄÀÏÀÌ rc2.d rc3.d rc5.d ¿¡¸¸ ÀÖÁÒ? -------------------------------------------------------------------- 5. ²¿¸´¸», Âü°íÀÚ·á -------------------------------------------------------------------- ¿©·¯°¡Áö·Î ºÎÁ·ÇÑ ¹®¼­ÀÌÁö¸¸, ³ª¸§´ë·Î ¸®´ª½ºÀÇ ºÎÆ® ÇÁ·Î¼¼½º¿¡ ´ëÇØ ¾Ë°í ÀÖ´Â ³»¿ëµéÀ» Á¤¸®ÇØ º¸¾Ò½À´Ï´Ù. Á¦°¡ óÀ½ ¸®´ª½º¸¦ °øºÎÇÒ ¶§ ÀÌ¿¡ °üÇÑ ÀÚ·á°¡ ¾ø¾î¼­ ¿©±âÀú±â »ðÁúÇϸ鼭 °í»ýÇÑ °ÍÀÌ »ý°¢³ª´Â±º¿ä T_T ºÎµð Ãʺ¸ÀÚ(³ªµµ ¾ÆÁ÷ Ãʺ¸¸¦ ¸ø¹þ¾î³­°Å °°Áö¸¸ -_-;)´ÔµéÀÌ ÀÌ ¹®¼­¸¦ º¸°í ÀÚ½ÅÀÇ ¸®´ª½º ½Ã½ºÅÛ ¼³Á¤À» ¹Ù²Ù´Â ÀÏÀ» Á» ´õ ¼ö¿ùÇÏ°Ô ´À²¼À¸¸é ÁÁ°Ú½À´Ï´Ù. ÀÌ ¹®¼­°¡ ´Ù¸¥ ¸¹Àº ¹®¼­µé »çÀÌ¿¡¼­ ¾µµ¥¾ø´Â(!) ¹®¼­ Çϳª¸¦ ´õÇÏ´Â ²ÃÀÌ µÇ¾î¼­ ÀڷḦ ãÀ¸½Ã´Â ºÐµé²² È¥¶õÀ» ³¢Ä¡°Ô µÇÁö³ª ¾ÊÀ»±î ÇÏ´Â °ÆÁ¤µµ ÀÖÁö¸¸.. ^^; °¨È÷ ÀÌ·¸°Ô kldp ¿¡ Á¦ ÀúÀÛ¹°À» ¿Ã·Á º¾´Ï´Ù. ÀÐÀ¸½Ã´Â ºÐµéÀÇ µû²ûÇÑ ÁöÀûÀ» ±â´Ù¸®°Ú½À´Ï´Ù. ---------- Âü°íÀÚ·á : Essential System Administration / AEleen Frisch / O'REILLY The Design of the UNIX Operating System / M.J.Bach / Prentice Hall ¶Ç´Ù¸¥ ¸®´ª½ºÀÇ ¼¼°è Áß SysV ÃʱâÈ­ / À̸¸¿ë / kldp ¸®´ª½º inittab, init ¸ÇÆäÀÌÁö