#!/bin/sh for i in /run/ppp/??*.pid ; do if [ -r $i ] ; then PID=`head -n 1 $i` IF=`sed -n '2p' $i` if [ -z "$PID" ] || [ -z "$IF" ] || ! kill -0 $PID 2>/dev/null; then echo "pppoe-status: Process $PID for interface $IF does not exist" continue fi if ! ip route | grep -qw "dev $IF"; 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" ip addr show $IF exit 0 fi done echo "ppppoe-status: Link is down" exit 1