From owner-freebsd-questions@FreeBSD.ORG Wed Aug 29 19:18:24 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 723C416A418 for ; Wed, 29 Aug 2007 19:18:24 +0000 (UTC) (envelope-from Hinkie@paradise.net.nz) Received: from smtp4.clear.net.nz (smtp4.clear.net.nz [203.97.37.64]) by mx1.freebsd.org (Postfix) with ESMTP id 3D95713C458 for ; Wed, 29 Aug 2007 19:18:24 +0000 (UTC) (envelope-from Hinkie@paradise.net.nz) Received: from cheqsoftserver (203-97-234-182.cable.telstraclear.net [203.97.234.182]) by smtp4.clear.net.nz (CLEAR Net Mail) with SMTP id <0JNJ0081OUYMJK00@smtp4.clear.net.nz> for freebsd-questions@FreeBSD.ORG; Thu, 30 Aug 2007 07:18:23 +1200 (NZST) Date: Thu, 30 Aug 2007 07:16:56 +1200 From: Hinkie To: Eric Crist Message-id: <01cd01c7ea71$2aa3cb50$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 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7bit X-Priority: 3 X-MSMail-priority: Normal References: <01a901c7ea3d$0ad62720$1e00a8c0@cheqsoft.local> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: 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 19:18:24 -0000 Hi Eric Thank you for that, I think I see one thing I was doing wrong (putting the ping into the if!) Running your code in the command window I get (Following the successful ping) TESTV=0: Command not found. TESTV: Undefined variable. As you can tell I am learning this syntax! Can you help me further? With thanks David Hingston ----- Original Message ----- From: "Eric Crist" To: "Hinkie" Cc: Sent: Thursday, August 30, 2007 2:17 AM Subject: Re: FreeBSD Cron Job to run (ifconfig em0 down; ifconfig em0 up) 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