#!/bin/sh ant="" while [ 1 ]; do ip=`ifconfig pppoe0|grep "inet "|awk '{print $2}'` if [ "$ip" != "$ant" ] then /path/to/script fi ant=$ip sleep 300 done