using Gargoyle (currently 1.3.7) for quite some time as a Wireless bridge connected to my cellar buildserver, I'm encountering "Destination Host Unreachable" messages after some hours. I'm not sure yet if it's a lockup or just a lost connection but for experimenting I wrote a keepalive script worth sharing from my perspective, i.e. I hope someone else using Gargoyle as a Wireless bridge may benefit from it.
Put the following to /bin/keepalive
Code: Select all
#!/bin/sh
rm -f /tmp/keepalive
ping -c 3 $(uci get network.lan.gateway) > /tmp/keepalive 2> /dev/null
state=$?
percent=$(awk '/packets/ {split($7, z, "%"); print z[1]}' /tmp/keepalive)
if [ $state -ne 0 ] || [ $percent -eq 100 ]; then
logger -p user.info -t keepalive[$$] "renewing connection to $(uci get network.lan.gateway)"
ifup lan
/sbin/wifi
fi
Code: Select all
root@Gargoyle:~# echo "*/5 * * * * /bin/keepalive >> /etc/crontabs/root
root@Gargoyle:~# /etc/init.d/cron restart
Also (+ question in my topic's subject), while looking at /etc/crontabs/root, I'm wondering why data is written to flash memory every 4 hours? Isn't that a rather bad idea from a flash memory wear-out perspective, i.e. wouldn't /tmp be a better target for it?
best,0 0,4,8,12,16,20 * * * date -u +"%Y.%m.%d-%H:%M:%S" >/usr/data/time_backup
orange