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 != 1) then ifconfig em0 down; ifconfig em0 up endif
if ping -c1 a.b.c.1 != 1 then ping -c1 220.127.116.11 endif
if ping -c1 a.b.c.1 (ifconfig em0 down; ifconfig em0 up)
if ( ping -c1 a.b.c.1 != 1) ( ping -c1 18.104.22.168 )
if $command("=ping -c1 a.b.c.1 =0") 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) == @(*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.