I have a file called /scripts/checkInternet
and it contains:
#!/bin/bash
WGET="/usr/bin/wget"
rm /tmp/index.google
$WGET -q --tries=10
--timeout=5 http://www.google.com -O /tmp/index.google &> /dev/null
if [ ! -s /tmp/index.google ];then
echo "Nope"
ifdown eth0.4
ifup eth0.4
iptables-restore < /etc/iptables.rules
else
echo "Connected"
fi
rm /tmp/index.google
I did chmod +x 755
this file. I can run it as root, but adding it to a cron as root it doesn't function.
What went wrong? The cron itself is being run. I see CMD (/scripts/checkInternet)
in my system logs but the desired outcome is missing.