⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pppoe-status

📁 网上的一个开源代码
💻
字号:
#!/bin/sh#***********************************************************************## pppoe-status## Shell script to report on status of PPPoE connection## Copyright (C) 2000-2001 Roaring Penguin Software Inc.## $Id: pppoe-status,v 1.1 2005/08/09 02:49:18 dfs Exp $## This file may be distributed under the terms of the GNU General# Public License.## LIC: GPL## Usage: pppoe-status [config_file]# If config_file is omitted, defaults to /etc/ppp/pppoe.conf##***********************************************************************# DefaultsCONFIG=/etc/ppp/pppoe.confcase "$#" in    1)	CONFIG="$1"	;;esacif [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then    echo "$0: Cannot read configuration file '$CONFIG'" >& 2    exit 1fi. $CONFIGPPPOE_PIDFILE="$PIDFILE.pppoe"PPPD_PIDFILE="$PIDFILE.pppd"if [ "$DEMAND" != "no" ] ; then    echo "Note: You have enabled demand-connection; pppoe-status may be inaccurate."fi# If no PPPOE_PIDFILE, connection is down, unless we're using the Linux pluginif [ "$LINUX_PLUGIN" = "" ] ; then    if [ ! -r "$PPPOE_PIDFILE" ] ; then	echo "pppoe-status: Link is down (can't read pppoe PID file $PPPOE_PIDFILE)"	exit 1    fifi# If no PPPD_PIDFILE, something fishy!if [ ! -r "$PPPD_PIDFILE" ] ; then    echo "pppoe-status: Link is down (can't read pppd PID file $PPPD_PIDFILE)"    exit 1fiPPPD_PID=`cat "$PPPD_PIDFILE"`# Sigh.  Some versions of pppd put PID files in /var/run; others put them# in /etc/ppp.  Since it's too messy to figure out what pppd does, we# try both locations.for i in /etc/ppp/ppp*.pid /var/run/ppp*.pid ; do    if [ -r $i ] ; then	PID=`cat $i`	if [ "$PID" = "$PPPD_PID" ] ; then	    IF=`basename $i .pid`	    netstat -rn | grep " ${IF}\$" > /dev/null	    # /sbin/ifconfig $IF | grep "UP.*POINTOPOINT" > /dev/null	    if [ "$?" != "0" ] ; then		echo "pppoe-status: Link is attached to $IF, but $IF is down"		exit 1	    fi	    echo "pppoe-status: Link is up and running on interface $IF"	    /sbin/ifconfig $IF	    exit 0	fi    fidoneecho "pppoe-status: Link is down -- could not find interface corresponding to"echo "pppd pid $PPPD_PID"exit 1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -