#PEAR_Config 0.9 a:12:{s:7:"php_dir";s:67:"//pear/php";s:8:"data_dir";s:68:"//pear/data";s:7:"www_dir";s:67:"//pear/www";s:7:"cfg_dir";s:67:"//pear/cfg";s:7:"ext_dir";s:67:"//pear/ext";s:7:"doc_dir";s:68:"//pear/docs";s:8:"test_dir";s:69:"//pear/tests";s:9:"cache_dir";s:69:"//pear/cache";s:12:"download_dir";s:72:"//pear/download";s:8:"temp_dir";s:68:"//pear/temp";s:7:"bin_dir";s:63:"//pear";s:7:"man_dir";s:67:"//pear/man";}
Server IP : 99.192.176.69  /  Your IP : 216.73.217.59
Web Server : Apache
System : Linux platinumpuzzy2.eosdns.net 3.10.0-1160.71.1.el7.x86_64 #1 SMP Tue Jun 28 15:37:28 UTC 2022 x86_64
User : bbwcamhouse ( 1000)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0555) :  /../etc/python/../python/../python/../python/../python/../python/../../sbin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //../etc/python/../python/../python/../python/../python/../python/../../sbin/pppoe-status
#! /bin/bash
#***********************************************************************
#
# pppoe-status
#
# Shell script to report on status of PPPoE connection
#
# Copyright (C) 2000-2001 Roaring Penguin Software Inc.
#
# $Id$
#
# 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
#
#***********************************************************************

# Defaults
LS=/bin/ls
NETWORKDIR=/etc/sysconfig/network-scripts

get_device() {
    if [ ! -d $NETWORKDIR ] ; then
        $ECHO "** $NETWORKDIR not found"
        $ECHO "** Quitting"
        exit 1
    fi

    cd $NETWORKDIR
    interfaces=$($LS ifcfg-ppp* 2>/dev/null | egrep -v '(~|\.bak)$' | \
                 egrep -v '(rpmsave|rpmorig|rpmnew)' | sed 's/^ifcfg-//g')

    for i in $interfaces ; do
        test -f ifcfg-$i && . ifcfg-$i 2>/dev/null
        if [ "$TYPE" = "xDSL" ] ; then
            CONFIG=$NETWORKDIR/ifcfg-$i
            break
        fi
    done
}

CONFIG="$1"
if [ -z "$CONFIG" ] ; then
    get_device
    [ -z "$CONFIG" ] && CONFIG=/etc/ppp/pppoe.conf
fi

if [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then
    echo "$0: Cannot read configuration file '$CONFIG'" >& 2
    exit 1
fi

. $CONFIG

PPPOE_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 plugin
if [ "$LINUX_PLUGIN" = "" ] ; then
    if [ ! -r "$PPPOE_PIDFILE" ] ; then
	echo "pppoe-status: Link is down (can't read pppoe PID file $PPPOE_PIDFILE)"
	exit 1
    fi
fi

# 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 1
fi

PPPD_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
	    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/ip addr show $IF
	    exit 0
	fi
    fi
done

echo "ppppoe-status: Link is down -- could not find interface corresponding to"
echo "pppd pid $PPPD_PID"
exit 1