From owner-freebsd-questions@FreeBSD.ORG Wed Aug 29 13:20:22 2007 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7329616A418 for ; Wed, 29 Aug 2007 13:20:22 +0000 (UTC) (envelope-from Hinkie@paradise.net.nz) Received: from smtp5.clear.net.nz (smtp5.clear.net.nz [203.97.33.68]) by mx1.freebsd.org (Postfix) with ESMTP id 3F48813C48E for ; Wed, 29 Aug 2007 13:20:22 +0000 (UTC) (envelope-from Hinkie@paradise.net.nz) Received: from cheqsoftserver (203-97-234-182.cable.telstraclear.net [203.97.234.182]) by smtp5.clear.net.nz (CLEAR Net Mail) with SMTP id <0JNJ00KXUDORDU30@smtp5.clear.net.nz> for freebsd-questions@FreeBSD.ORG; Thu, 30 Aug 2007 01:05:15 +1200 (NZST) Date: Thu, 30 Aug 2007 01:03:49 +1200 From: Hinkie To: freebsd-questions@FreeBSD.ORG Message-id: <01a901c7ea3d$0ad62720$1e00a8c0@cheqsoft.local> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.3790.2929 X-Mailer: Microsoft Outlook Express 6.00.3790.2929 X-Priority: 3 X-MSMail-priority: Normal Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: FreeBSD Cron Job to run (ifconfig em0 down; ifconfig em0 up) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2007 13:20:22 -0000 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? I've tried all sorts such as: if (ping -c1 a.b.c.1 !=3D 1) then ifconfig em0 down; ifconfig em0 up = endif if ping -c1 a.b.c.1 !=3D 1 then ping -c1 203.97.234.1 endif if ping -c1 a.b.c.1 (ifconfig em0 down; ifconfig em0 up) if ( ping -c1 a.b.c.1 !=3D 1) ( ping -c1 203.97.234.182 ) if $command("=3Dping -c1 a.b.c.1 =3D0") echo sucess if ping -c 1 -w 1 a.b.c.1 >/dev/null echo sucess if [[ (ping -q -c 3 a.b.c.1) =3D=3D @(*100% packet loss*) ]]; echo = sucess if ! ping -c a.b.c.1 > /dev/null ; then echo sucess ; echo fail; fi Any help would be appreciated. Kind regards David Hingston=20