0

Have next bash script /home/admin2/wlan0r.sh under root:

#!/bin/bash

while true; do
        if ping -c 1 -W 5 192.168.1.254; then
                sleep 15
        else
                echo "PING GW ERROR"
                ifdown wlan0
                sleep 2
                ifup wlan0
        fi
done

and sudo crontab -l job:

# ...
* * * * * /home/admin2/wlan0r.sh

and that doesn't work (script wont down and up wlan0 interface when wifi router reboots). But when i type directly from keyboard: sudo -i, then ifdown wlan0, then ifup wlan0 all works fine (successfully reconnected to WiFi AP)

What i missed up?

0 Answers0