ÀÌÀüÆäÀÌÁö ´ÙÀ½ÆäÀÌÁö Â÷·Ê

6. ¾î¶»°Ô Á¢¼Ó ÀýÂ÷¸¦ ÀÚµ¿È­Çϴ°¡? (How do I automate the connection procedure?)

¸®´ª½º¿¡¼­ ´º½º¿Í ÀüÀÚ¿ìÆíÀ» ÀÚµ¿À¸·Î ó¸®ÇÏ´Â °ÍÀ» ±¸ÇöÇÏ´Â °ÍÀº ¸Å¿ì ½±´Ù.

¸ÕÀú ¹«¾ùº¸´Ù ISP·ÎÀÇ ¿¬°áÀ» ÃʱâÈ­ÇØ ÁÖ´Â /usr/lib/ppp/ppp-onÀ» ¸¸µé¾î¾ß ÇÑ´Ù. º¸Åë, ÀÌ ÆÄÀÏÀº °£´ÜÈ÷ ´ÙÀ½°ú °°Àº °ÍÀ» ´ã°í ÀÖ´Ù:

/usr/sbin/pppd
´õ ÀÚ¼¼ÇÑ ¼³Á¤Àº /etc/ppp/options¿¡¼­ ¼öÇàµÈ´Ù:
connect "/usr/lib/ppp/chat -v -f /etc/ppp/chatscript"
crtscts
modem
defaultroute
asyncmap 00000000
user dirk
/dev/modem 38400

¿¬°áÀ» ³¡³»±â À§Çؼ­, /usr/lib/ppp/ppp-off°¡ µé¾îÀÖ´Â ¹öÀüÀ» »ç¿ëÇÏ¸é µÈ´Ù.

ÀÌ µÎ ½ºÅ©¸³Æ®ÀÇ ±â´ÉÀ» ½ÃÇèÇÏ°í ³ª¸é, ¿©·¯ ÀÛ¾÷À» ¼öÇàÇÏ´Â ½ºÅ©¸³Æ®¸¦ ÀÛ¼ºÇØ¾ß ÇÑ´Ù. ÀÌ ½ºÅ©¸³Æ®´Â ¾Õ¿¡¼­ ¼³¸íÇÑ ¸ÞÀϵéÀ» °¡Á®¿À´Â ÀÏÀ» ÇÑ´Ù, ±×¸®°í ÀÌ°ÍÀÌ /home/dirk/pop¿¡ ÀÖ´Ù´Â °ÍÀ» °¡Á¤ÇÑ´Ù.

¸ÞÀÏÀ» ÁÖ°í¹Þ±â À§ÇÑ ½ºÅ©¸³Æ®´Â /root/mail¿¡ »ý¼ºµÈ´Ù:

#! /bin/sh
#
# exchange mail
# 10 minutes timeout:
TIMEOUT=600
DT=10

# kick sendmail:
sendmail -q &

# retrieve mail:
su dirk -c /home/dirk/pop

# wait for sendmail to terminate:
t=0
while ! mailq | grep -q "Mail queue is empty"; do
    t=$[$t+$DT]
    if [ $t -gt $TIMEOUT ] ; then
     echo "sendmail -q timeout ($TIMEOUT).."
     exit 1
    fi
    sleep $DT
done

exit 0

´º½º¸¦ ÁÖ°í¹Þ±â À§ÇÑ ½ºÅ©¸³Æ®´Â /usr/lib/news/news¿¡ À§Ä¡ÇÑ´Ù:

#!/bin/sh
#
# exchange news
# must be run as news:
cd /usr/lib/news

#update the outgoing batch (C News):
/usr/lib/newsbin/input/newsrun < /dev/null

#exchange news:
/usr/lib/newsbin/newsx acme news.acme.net

#and flush the incoming batch:
/usr/lib/newsbin/input/newsrun < /dev/null
A script to connect the various bits and pieces remains, and can be placed in /root/news+mail:
#!/bin/sh
#
# exchange news and email
# must be run as root
#
if ! /usr/lib/ppp/ppp-on; then
    exit 1
fi
trap "/usr/lib/ppp/ppp-off" 1 2 3 15

#exchange news+mail:
/root/mail &
su news -c ~news/news
wait

#disconnect..
/usr/lib/ppp/ppp-off

#update the incoming batch (C News):
su news -c /usr/lib/newsbin/input/newsrun < /dev/null &

exit 0

¿ÜºÎ·Î ³ª°¥ ¸ÞÀÏÀ̳ª ´º½º°¡ ÀÖ´Â °æ¿ì Á¢¼ÓÇϵµ·Ï È®ÀåÇÏ´Â °ÍÀº ¸Å¿ì ½±´Ù. ÀÌ°ÍÀ» /root/news+mail¶ó ÇÏÀÚ, ±×¸®°í ¿ÜºÎ·Î ³ª°¥ ´º½º-½ºÇ®ÀÇ À̸§ÀÌ ¾Ë¸Â°Ô °»½ÅµÇ¾î¾ß ÇÑ´Ù´Â °ÍÀ» »õ°ÜµÐ´Ù:

#!/bin/sh
#
# exchange news and email, only if outgoing news or mail
# (C News spool)
if [ -s /var/spool/news/out.going/acme/togo ] ||
    ! ( mailq | grep -q "Mail queue is empty"); then
     /root/news+mail
fi

ÀÌÁ¦ ³²Àº °ÍÀº ¾ðÁ¦ ³»º¸³»¾ß ÇÒÁö Á¤ÇÏ´Â ÀÏ »ÓÀÌ´Ù. ÀÌ°ÍÀº root·Î crontab -e ¸í·É¾î·Î ¼öÇàµÈ´Ù. ¿ì¸®´Â Ç×»ó ´º½º¿Í ¸ÞÀÏÀ» ¾Æħ 07:00 ¿¡ ÁÖ°í¹Þ°í, ¿ÜºÎ·Î ³ª°¡´Â ¸ÞÀÏ°ú ´º½º¸¦ ¸Å ³×½Ã°£ ¸¶´Ù ³»º¸³½´Ù°í °¡Á¤ÇÏÀÚ.

00 7      * * *     /root/news+mail
00 11,15,19,23 * * *     /root/news+mail.cond
°¢°¢ÀÇ ºÎºÐµéÀ» °°ÀÌ ¿¬°áÇϱâ Àü¿¡ ÃæºÐÈ÷ ½ÃÇèÇغ¼ °ÍÀ» ±ÇÇÑ´Ù. ³ªÁß¿¡ ´Ù¸¥ ÀϵéÀ» ÷°¡ÇÒ ¼öµµ ÀÖ´Ù. ¿¹¸¦ µé¾î ½Ã°£À» ¸ÂÃá´Ù´ø°¡ (ntpdate ¸¦ ÀÌ¿ë), ·ÎÄ÷Π¿î¿µµÇ´Â WWWÀÇ ÀÚµ¿ÀûÀÎ °»½Å(¹Ì·¯¸µ), ±×¸®°í FTP ÆÄÀÏÀ» ISP·Î ¾÷ÇÏ´Â °Í(make¿Í ftp¸¦ ÀÌ¿ë) µîÀÌ ÀÖ´Ù.

´ë¾È: ÃëÇâ¿¡ µû¶ó¼­, ÇÁ·Î¼¼½º°¡ ¾û¸ÁÀÌ µÉ ¼öµµ ÀÖ´Ù. PPP ¸µÅ©°¡ ÃʱâÈ­ µÉ¶§¸¶´Ù, /etc/ppp/ip-up ½ºÅ©¸³Æ®°¡ ½ÃÀ۵ȴÙ. ¿©±â¿¡ ÀüÀÚ¿ìÆí°ú ´º½º¸¦ ÁÖ°í¹Þ±â À§ÇØ ÇÊ¿äÇÑ ¾î¶°ÇÑ magicÀ̵ç Ãß°¡½Ãų ¼ö ÀÖ´Ù. ÀÚ¼¼ÇÑ »çÇ×Àº man pppd¸¦ ÂüÁ¶Çϱ⠹ٶõ´Ù.

´ë¾È: ³×Æ®¿÷ Æ®·¡ÇÈ ¿ä±¸°¡ °¨ÁöµÇ¾úÀ» ¶§¸¶´Ù ÀÚµ¿À¸·Î PPP Á¢¼ÓÀ» ÇÒ ¼öµµ ÀÖ´Ù. ¿©±â¿¡´Â ¸¹Àº Á¤¹ÐÇÑ ¹æ¹ýµéÀÌ ÀÖÁö¸¸, ÀÚÁÖ Á¢¼ÓÀÌ ÀÌ·ç¾îÁö´Â °ÍÀ» ¸·±â À§Çؼ­ ÁÁÀº ¼³Á¤¿¡ Å©°Ô ÀÇÁ¸ÇÑ´Ù. ´õ ¸¹Àº Á¤º¸´Â ¿©±â¼­ ±¸ÇÒ ¼ö ÀÖ´Ù:

http://www.cs.toronto.edu/~schenk/diald.html

diald À¯Æ¿¸®Æ¼´Â ¿©±â¼­ ±¸ÇÒ ¼ö ÀÖ´Ù:

ftp://sunsite.unc.edu/pub/Linux/system/Network/serial/diald-0.13.tar.gz

¿ª½Ã ±×°÷¿¡¼­ ´Ù¸¥ ´Ù¾çÇÑ PPP Á¢¼Ó ¹æ¹ýÀ» ¹ß°ßÇÏ°Ô µÉ °ÍÀÌ´Ù.


ÀÌÀüÆäÀÌÁö ´ÙÀ½ÆäÀÌÁö Â÷·Ê