[wplug] IPCop script

Arnaud Loos aloos at InnovationsTech.com
Mon Jun 16 10:21:07 EDT 2003


I'm trying to use a script on my ipcop box that runs every 5 minutes and
checks to see if my IP has changed. If it has then bring the network
down and up with the new ip. The script is as follows.

#!/bin/sh

ping -c1 `netstat -rn | grep ^0.0.0.0 | awk '{print $2}'`

if [ "$?" != "0" ] ; then
	/etc/rc.d/netaddress.down
	/etc/rc.d/netaddress.up
fi

I copied this script from ipcop's archives. When I run it manually, the
packet goes out, I get the reply, and then I get the error:

/usr/local/sbin/checkconnect: [: missing ']'

Any ideas where I messed up the syntax?

Thanks.

Arnaud-





More information about the wplug mailing list