FreeBSD Cron Job to run (ifconfig em0 down; ifconfig em0 up)

Eric Crist mnslinky at gmail.com
Wed Aug 29 12:30:31 PDT 2007


David,

The script I provided assumes the sh shell.  Most shell scripts have  
been historically written for the bourne shell.  Before running the  
script I sent you, try typing sh<enter> at the command line.  Then,  
run the line I sent your way.

Let me know how it works for you!

Eric


On Aug 29, 2007, at 2:16 PMAug 29, 2007, Hinkie wrote:

> 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" <mnslinky at gmail.com>
> To: "Hinkie" <Hinkie at paradise.net.nz>
> Cc: <freebsd-questions at FreeBSD.ORG>
> 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
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions- 
> unsubscribe at freebsd.org"

-----
Eric F Crist
Secure Computing Networks




More information about the freebsd-questions mailing list