What's new

Scripting wireless service restarts

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

JoeyJoe

New Around Here
I am not really a programmer, but I needed to solve an issue related to having multiple APs setup to cover approx 10000 sq feet of land. Wanted to post what I am using to share since most (if not all) I was able to gather and paste together via forums like this.

Overview:
5 non overlapping APs (not all Asus hardware), all same SIDDs
4 of them are setup in a square layout and are wire connected to a central switch
and 1 is isolated off in a corner of the property
this 1 alone AP is set up in (asus merlin) repeater mode and connects up to the main AP cluster. I get excellent bandwidth and signal from my directional antenna.

Problem:
The repeater mode AP works great on first association with an AP that I manually point it to and joined, however after some time, something happens and the manual AP that I joined drops the repeater AP. I do not loose network connection since the repeater mode AP connects up to one of the remaining 3 AP automatically keeping my connection available (due to same SIDD), however the result of this is a very slow speed.

Solution:
1. restart the repeater AP, or just restart its wireless service. It joins back up to the AP with the strongest signal again (the one i originally joined for repeater mode)

2. I pieced together a script to check the connection every hour and if needed restart the wireless service on the asus router.

SCRIPTS:
created a service-start script via this (found in another thread on this site) to check every hour. Needed this so upon router reboot the schedule would not be lost

cat << EOF > /jffs/scripts/services-start
#!/bin/sh
/usr/sbin/cru a AP-check "0 1 * * * APCheckLink"
EOF

My script checks the return value from a ping command. I noticed when I was not connected to the preferred AP that pings were over 100ms++, but on usual connections were 35ms and less, so I just picked 50ms to check against. I just drop a note in the syslog so I know that the script is running

/jffs/scripts/AP-check:
total=$(ping -c 4 www.stackoverflow.com | awk -F '/' '{print substr($5,0,2)}'); if [ "$total" -gt 50 ]; then echo "$(date)" " " $total"ms - restarting wireless" >> /tmp/syslog.log ; /sbin/restart_wireless ; else echo "$(date)" " "$total"ms - Connection is good" >> /tmp/syslog.log ; fi

Had to change the file access flags for my service start script as well as my AP-check script

chmod a+rx /jffs/scripts/services-start
chmod a+rx /jffs/scripts/AP-check

And this one was just to start the scheduling. Or could just issue the cru command manually
/jffs/scripts/services-start


So I though I would share. I am sure there is plenty of great minds out there that are scratching their heads on why I went about it the way I did, but like I said, im not a programmer.. lol

comments are always welcomed..

Cheers all!!
 
Last edited:

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top