Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Aug 2007 09:17:13 -0500
From:      Eric Crist <mnslinky@gmail.com>
To:        Hinkie <Hinkie@paradise.net.nz>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: FreeBSD Cron Job to run (ifconfig em0 down; ifconfig em0 up)
Message-ID:  <FD866B42-B6DA-4AC1-A4B0-EC858835CEBE@gmail.com>
In-Reply-To: <01a901c7ea3d$0ad62720$1e00a8c0@cheqsoft.local>
References:  <01a901c7ea3d$0ad62720$1e00a8c0@cheqsoft.local>

next in thread | previous in thread | raw e-mail | index | archive | help
On Aug 29, 2007, at 8:03 AMAug 29, 2007, Hinkie wrote:

> Hi
>
> I want to run a cron job in /etc/crontab that runs (ifconfig em0  
> down; ifconfig em0 up) if my cables static ip gateway can't be  
> pinged but I can't figure it out.  I can't get the syntax that runs  
> in the command window, to then put intot the crontab....
>
> Can anyone help me?

Here's what I'd use:

ping -c 1 a.b.c.d; TESTV=$?; if [ $TESTV != 0 ]; then `ifconfig em0  
down`; fi

HTH
-----
Eric F Crist
Secure Computing Networks





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FD866B42-B6DA-4AC1-A4B0-EC858835CEBE>