#!/bin/sh for i in /run/ppp/??*.pid ; do if [ -r "$i" ] && [ `wc -l < "$i"` -eq 2 ] ; then PID=`head -n 1 "$i"` IF=`sed -n '2p' "$i"` if [ -z "$PID" ] || [ -z "$IF" ] || ! ps -p "$PID" &>/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