[wplug] IPCop script

Vanco, Donald VANCOD at PIOS.com
Mon Jun 16 13:46:19 EDT 2003


Arnaud Loos wrote:
> 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?

	I don't see anything at first glance.  Just out of curiosity - did
you do any editing of / pass this file through a Windoze box?  I've had lots
of scripts get muddled by thinking "a text editor is a text editor".....
just a thought...

Don




More information about the wplug mailing list