Next Previous Contents

6. §Ú­n«ç»ò±N³s±µµ{§Ç¦Û°Ê¤Æ©O ?

¦b Linux ùØ­n±±¨î·s»D¸s²Õ¥H¤Î¹q¤l¶l¥ó¬O¥ó«Ü®e©ö°µªº¨Æ±¡¡C

­º¥ý°µ­Ó /usr/lib/ppp/ppp-on ¨Óªì©l»P ISP ªº³s±µ¡C³q±`¡A³o­ÓÀÉ®×¥u¥]§t¤U¦C¡G

/usr/sbin/pppd
§ó¦hªº¿ï¶µ·|¦b /etc/ppp/optionsùØ°õ¦æ¡G
connect "/usr/lib/ppp/chat -v -f /etc/ppp/chatscript"
crtscts
modem
defaultroute
asyncmap 00000000
user dirk
/dev/modem 38400

­nµ²§ô³s±µ¡A¨Ï¥Î¥»¨­´£¨Ñªº /usr/lib/ppp/ppp-off¡C

¦b¸Õ¹L³o¨â­Ó©R¥O¤â½Zªº¥\¯à«á¡A¦pªG§A·Q¼g­Ó°õ¦æ¤£¦P¤u§@ªº©R¥O¤â½Z¡C ¤W­±¤w´£¹L»`¶°¹q¤l¶l¥óªº©R¥O¤â½Z¤F¡A§Ú­Ì¦b³o¨à°²³]¥¦­Ì(¹q¤l¶l¥ó)·|³Q ©ñ¦b /home/dirk/popùØ¡C

§Ú­Ì¥i¥H»s³y¤@­Ó¥æ´«¹q¤l¶l¥óªº©R¥O¤â½Z /root/mail¡G

#! /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

¥æ´« news ªº©R¥O¤â½Z©ñ¦b /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.xz

#and flush the incoming batch:
/usr/lib/newsbin/input/newsrun < /dev/null
¨ä¥L³s±µ¦U¦¡¦U¼Ë¯dµÛªº¸ê°T¤§©R¥O¤â½Z¥i³Q©ñ¸m¦b /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

­n¬°¤W­±ªº¨Ò¤l°µÂX¥R¬O«Ü®e©öªº¡A¥u»Ý·í¦V¥~ªº¹q¤l¶l¥ó¤Î·s»D§G§i¦s¦b®É¦A°µ³s±µ¡C §Ú­Ì´N¥s¥¦ /root/news+mail.cond¡A °O±o¦V¥~ªº news-spool ¤]¥²¶·§ó·s¥H¬Û°t¦X¡G

#!/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

²{¦b¥u³Ñ«ü©w¦ó®É³o¨Ç¨Æ­nµo¥Í¦Ó¤w¡C³o¥i¥H root ªº¨­¥÷¡A¨Ï¥Î crontab -e ©R¥O¨Ó¹F¦¨¡C°²³]§Ú­Ì§Æ±æ¨C¤Ñ¦­¤W 07:00 ®É°µ·s»D°Q½×¸ê®Æ©M¹q¤l¶l¥óªº¥æ´«¤u§@¡A¤§«á °²³]¨C¥|¤p®É·|¦³¦V¥~ªº¹q¤l¶l¥ó©M·s»D°Q½×­n°e¡G

00 7            * * *   /root/news+mail
00 11,15,19,23  * * *   /root/news+mail.cond
¦b±N¥¦­Ì³s±µ«e¡A½Ð½T»{¨C¤@­ÓÀôµ²³£³Q´ú¸Õ¨S°ÝÃD¡C§A¤]¥i¥H¤§«á¦A¥[¤W ¨ä¥L³\¦hªº¤u§@¡A¨Ò¦p½Õ¾ã¤é´Áªº®É¶¡ (¨Ï¥Î ntpdate)¡A¦Û°Ê§ó·s (¬M®g) ¥»¦aºÝºûÅ@ªº WWW ¤Î FTP ÀÉ®× ¨ì ISP (¨Ï¥Î make ©M ftp)¡C

ALT: ¨Ì·Ó¨C­Ó¤Hªº³ß¦n¤£¦P¡A¤]¥i¥HÄA­Ë¶¶§Ç¡C¨C¦¸ PPP ³s±µ§¹¦¨«á¡A /etc/ppp/ip-up ©R¥O¤â½Z´N·|±Ò°Ê¡C §A¥i¥H¦b³o¨à¥[¤W¦UºØªá¼Ë¨Ó±Ò°Ê¹q¤l¶l¥ó»P·s»D°Q½×¤å³¹ªº¥æ´«¡C ¸Ô±¡¥i°Ñ¾\ man pppd ¡C

ALT: ¤]¥i¥H·íºô¸ô¬y³q³Q°»´ú¨ì®É¦Û°Ê¦a³s±µ PPP ¡C¦nªº¸Ñ¨M¤è®×¦³«Ü¦hºØ¡A ¦ý¦nªº«ØºcºÝ¬Ý¥¦«ç»ò¨ÓÁקKÀWÁcªº(ªá¿úªº)³s±µ¡C¤U­±¦ì§}¦³§ó¦hªº¸ê°T¡G

http://www.dna.lth.se/~erics/diald.html

³o­Ódiald ¤½¥Îµ{¦¡¥i¥Ñ¤U­±ªº¦ì§}¨ú±o¡G

ftp://sunsite.unc.edu/pub/Linux/system/network/serial/diald-0.16.tar.gz

¦b¦P¤@¦ì¸m¤W¡A§AÁÙ¥i¥Hµo²{¨Ï¥Î PPP ³s±µªº¨ä¥L¤£¦P¶µ¥Ø¡C


Next Previous Contents