LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1744|回复: 8

pon 是什么命令?

[复制链接]
发表于 2007-3-3 10:16:45 | 显示全部楼层 |阅读模式
在redhat 9下有没有pon命令?
发表于 2007-3-3 11:57:07 | 显示全部楼层
pon只是一个ppp的脚本主要内容其实就一行:
exec /usr/sbin/pppd call $PROVIDER "$@"

这个脚本应该是debian linux发行版中特有的,是由debian的ppp维护人员编写的。

下面是pon全部内容:
#!/bin/sh

while [ $# -ge 1 ]; do
case "$1" in
  --quick|-q)
    QUICK=true
    shift
    ;;
  -*)
    echo "\
Usage: pon [OPTIONS] [provider] [arguments]
  -q|--quick           pppd hangs up after all ip-up scripts are run

If pon is invoked without arguments, /etc/ppp/ppp_on_boot file will be
run, presuming it exists and is executable. Otherwise, a PPP connection
will be started using settings from /etc/ppp/peers/provider.
If you specify one argument, a PPP connection will be started using
settings from the appropriate file in the /etc/ppp/peers/ directory, and
any additional arguments supplied will be passed as extra arguments to
pppd.
"
    exit 0
    ;;
  *)
    break
    ;;
esac
done

if [ ! -r /etc/ppp/peers/ ]; then
  echo "Error: only members of the 'dip' group can use this command."
  exit 1
fi

if [ "$1" ]; then
  PROVIDER=$1
  shift
fi

if [ -z "$PROVIDER" ]; then
  if [ -x /etc/ppp/ppp_on_boot ]; then
    [ "$QUICK" ] && touch /var/run/ppp-quick
    exec /etc/ppp/ppp_on_boot
  fi
  # try the default script
  PROVIDER=provider
fi

if [ ! -e "/etc/ppp/peers/$PROVIDER" ]; then
  echo "\
The file /etc/ppp/peers/$PROVIDER does not exist. Please create it or use
a command line argument to use another file in the /etc/ppp/peers/ directory."
  exit 1
fi

[ "$QUICK" ] && touch /var/run/ppp-quick
exec /usr/sbin/pppd call $PROVIDER "$@"

与pon对应的脚本是poff。pon用你的拨号配置拨号上网;poff则相反,用于挂断ppp连接。
回复 支持 反对

使用道具 举报

发表于 2007-3-3 12:33:24 | 显示全部楼层
Arch Linux 中也有,可能就是用的 Debian 的吧
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-3-3 18:07:22 | 显示全部楼层
redhat 中有没有类似的命令可以拨号的,例如linux 做VPNclient的虚拟拨号。。
回复 支持 反对

使用道具 举报

发表于 2007-3-3 18:59:16 | 显示全部楼层
自己写一段不就行了?!实在不行还可以照葫芦画瓢吗。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-3-3 23:51:40 | 显示全部楼层
就是不会啊 郁闷。。。 救命啊。。。 麻烦大侠给出具体的方法。。。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-3-4 00:10:50 | 显示全部楼层
成功了。。。 多谢大侠。。。。。。。 非常感谢。。
麻烦把poff的代码也贴下出来好吗。。。。。 嘻嘻。。。
回复 支持 反对

使用道具 举报

发表于 2007-3-4 21:24:52 | 显示全部楼层
  1. cat /usr/bin/poff
  2. #!/bin/sh

  3. # $Id: poff,v 1.8 1999/08/28 16:34:51 phil Exp $
  4. # Written by John Hasler <john@dhh.gt.org> and based on work
  5. # by Phil Hands <phil@hands.com>.  Distributed under the GNU GPL

  6. if [ -x /usr/bin/kill ]; then
  7.   KILL="/usr/bin/kill"
  8. else
  9.   KILL="/bin/kill"
  10. fi
  11. SIG=TERM
  12. DONE="stopped"
  13. MODE=""

  14. usage ()
  15. {
  16.    cat <<!EOF!
  17. usage: $0 [option] [provider]
  18. options:
  19.   -r        Cause pppd to drop the line and redial.
  20.   -d        Toggle the state of pppd's debug option.
  21.   -c        Cause pppd to renegotiate compression.
  22.   -a        Stop all pppd's.  'provider' will be ignored.
  23.   -h        Print this help summary and exit.
  24.   -v        Print version and exit.
  25.   none      Stop pppd.

  26. Options may not be combined.

  27. If 'provider' is omitted pppd will be stopped or signalled if and only if
  28. there is exactly one running unless the '-a' option was given.  If
  29. 'provider' is supplied the pppd controlling the connection to that
  30. provider will be stopped or signalled.
  31. !EOF!
  32. }

  33. # Get option.  If there are none replace the "?" that getopts puts in
  34. # FLAG on error with "null".
  35. getopts rdcavh FLAG
  36. if [ "$?" -ne 0 ]; then
  37.     FLAG="null"
  38. fi

  39. # Check for additional options.  Should be none.
  40. getopts :rdcavh DUMMY
  41. if [ "$?" -eq 0 ]; then
  42.     echo "$0: Illegal option -- ${OPTARG}."
  43.     exit 1
  44. fi

  45. case $FLAG in
  46. "r") SIG=HUP;  DONE=signalled; shift ;;
  47. "d") SIG=USR1; DONE=signalled; shift ;;
  48. "c") SIG=USR2; DONE=signalled; shift ;;
  49. "a") MODE="all"; shift ;;
  50. "v") echo "$0$Revision: 1.8 $_TrickToPrint_RCS_Revision"; exit 0 ;;
  51. "h") usage; exit 0 ;;
  52. "?") exit 1;
  53. esac

  54. # Get the PIDs of all the pppds running.  Could also get these from
  55. # /var/run, but pppd doesn't create .pid files until ppp is up.
  56. PIDS=$(pidof pppd)

  57. # poff is pointless if pppd isn't running.
  58. if [ -z "$PIDS" ]; then
  59.     echo "$0: No pppd is running.  None ${DONE}."
  60.     exit 1
  61. fi

  62. # Find out how many pppd's are running.
  63. N=$(echo "$PIDS" | wc -w)

  64. # If there are no arguments we can't do anything if there is more than one
  65. # pppd running.
  66. if [ "$#" -eq 0 -a "$N" -gt 1 -a $FLAG != "a" ]; then
  67.     echo "$0: More than one pppd running and no "-a" option and
  68. no arguments supplied. Nothing ${DONE}."
  69.     exit 1
  70. fi

  71. # If either there are no arguments or '-a' was specified kill all the
  72. # pppd's.
  73. if [ "$#" -eq 0 -o "$MODE" = "all" ]; then
  74.     $KILL -$SIG $PIDS || {
  75.         echo "$0: $KILL failed.  None ${DONE}."
  76.         exit 1
  77.     }
  78.     exit 0
  79. fi

  80. # There is an argument, so kill the pppd started on that provider.
  81. PEER=$(echo $1 | sed -e 's#/#\\/#g')
  82. PID=$(ps -o pid,cmd axw | awk "/^ *[0-9]* *(\/usr\/sbin\/)?pppd call $PEER( |\$)/ {print \$1}")

  83. if [ "$PID" ]; then
  84.     $KILL -$SIG $PID || {
  85.         echo "$0: $KILL failed.  None ${DONE}."
  86.         exit 1
  87.     }
  88. else
  89.    echo "$0: I could not find a pppd process for provider '$1'. None ${DONE}."
  90.    exit 1
  91. fi

  92. exit 0
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-3-5 09:31:39 | 显示全部楼层
搞定了。。。。。THANK YOU VERY MUCH..
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表