A script that automatically turns the wifi-AP off and on, depending on the wifi-client connection
#!/bin/sh /etc/rc.common
START=99
start() {
testip=$(route -n | awk '/UG/ {print $2}')
sleep 60
while (true)
do
kol=$(ping -c 3 $testip | grep "received" | awk '{print $4}')
if [ $kol == 0 ]
then
ifconfig ra0 up
else
ifconfig ra0 down
fi
sleep 60
done
}
stop() {
ifconfig ra0 up
}