| Linux PPP HOWTO | ||
|---|---|---|
| 上一页 | 第 25 章。链路建立之后 -/etc/ppp/ip-up脚本 | 下一页 |
上一节介绍了如何处理外发邮件 - 简单地在链路建立后刷新邮件队列即可。
如果您正在运行 WAN 链路,您可以与远程 LAN 的网络管理员协商做完全相同的事情。例如,在我们的 WAN 链路的 Newman 园区端,/etc/ppp/ip-up脚本看起来像这样:-
#!/bin/bash
#
# Script which handles the routing issues as necessary for pppd
# Only the link to Hedland requires this handling.
#
# When the ppp link comes up, this script is called with the following
# parameters
# $1 the interface name used by pppd (e.g. ppp3)
# $2 the tty device name
# $3 the tty device speed
# $4 the local IP address for the interface
# $5 the remote IP address
# $6 the parameter specified by the 'ipparam' option to pppd
#
case "$5" in
203.18.8.4)
/usr/sbin/sendmail -q
;;
*)
esac
exit 0 |
但是,如果您只有到 ISP 的动态 IP PPP 链路,您需要从 ISP 机器上的帐户获取电子邮件。这通常使用 POP(邮局协议)完成。这个过程可以使用 'popclient' 程序处理 - 并且 ip-up 脚本也可以为您自动化这个过程!
只需创建一个/etc/ppp/ip-up脚本,其中包含对 popclient 的适当调用。对于我的运行 Red Hat Linux 的笔记本电脑(我旅行时随身携带),这是...
popclient -3 -c -u hartr -p <password> kepler.hedland.edu.au |formail -s procmail |
您可以使用 slurp 或其他任何程序来对新闻等执行相同的操作。请记住,ip-up 脚本只是一个标准的 bash 脚本,因此可以用于自动化每次适当的 PPP 链路建立时需要完成的任何功能。