ppp-start 用于连接供应商:
Example 23.7. ppp-start
#!/bin/sh
MODEM=tty01
POP=bignet
if [ -f /var/spool/lock/LCK..$MODEM ]; then
echo ppp is already running...
else
pppd call $POP
tail -f /var/log/messages
fi
ppp-stop 用于断开连接:
Example 23.8. ppp-stop
#!/bin/sh
MODEM=tty01
if [ -f /var/spool/lock/LCK..$MODEM ]; then
echo -f killing pppd...
kill -HUP `cat /var/spool/lock/LCK..$MODEM`
echo done
else
echo ppp is not active
fi
这两个脚本实际上利用了当 pppd 激活时, 它在/var/spool/lock 目录中创建的文件 LCK..tty01 . 这个文件包含了pppd 进程的进程ID (pid) of the process.
这两个T必须可运行:
代码: 全选
# chmod u+x ppp-start ppp-stop