Script To Reboot Cisco Wireless Access Points Daily

I recently faced a problem with our Cisco AP541N-A-K9 Dual Band Access Points. We have 5 in the office and users would complain that they were getting the “Limited Access” error or would not be able to connect at all. The problem would only happen in certain areas of the office with certain users. If the user would go to another area (switching access points), the error would go away and they would be fine. After troubleshooting the issue, I found that the only fix was to reboot the access point that was giving problems and everything would be fine. This wasn’t the perfect solution though because not all users on that access point would be having issues, and rebooting would kick everyone off for a short period of time.

I found that the best thing to do would be to write a script that would reboot all of the access points early in the morning before the users would get to work. That way all of the access points would have a clean slate to start with. Here’s how I did it:

I figured the best way to do this would be through Ubuntu with a cronjob. I spun up a VM with Ubuntu Server 12.0.4 and got started.

All of the access points have SSH enabled so I connected to one and saw the familier Cisco iOS.

Easily enough, all I need to do is run the Reboot command. I also wanted a way to make sure they did indeed reboot, so I will be taking use of the Get System Uptime command as well.

To start, I will be creating two files on each access point: reboot.sh and uptime.sh

Simple, right? Now lets create our script that will actually be doing all of the work. Hop back to your Ubuntu server and run the following commands:

The reason we are installing sshpass is that we can pass the credentials all in one line of code and we wont have to deal with installing ssh keys on each of the access points. The other app we are installing is MailUtilis, which we will configure to send us an email once the script completes.

Once they are done installing, lets create a file called reboot.sh that will house all of our commands.

You can see in the script that I am calling a /password.txt file. This is where your SSH password will be stored and then passed to the access points. All that this script is doing is calling the two files we created earlier on each of the access points and executing those commands. The 240 second sleep in between reboots is to give the access point enough time to come back online and re-register with the other access points. Once all of the reboots happen, it goes out and grabs the system uptime to verify that they rebooted.

We then need to make this file executable so a quick chmod will do the trick:

Now we need to set up this script to email us when it is done executing. We will be creating another script that will call the previous one, and pipe that out to MailUtilis.

We will also need to run chmod on it as well.

Now lets set up the Cronjob:

I figured 5:30am will allow enough time for them all to reboot before anyone would get in the office. If we set everything up we should be receive an email tomorrow morning.

And there it is! Now every morning I can check my email knowing that all of my access points are fresh and ready for a new day.

 

Hope this helps!

 

 

 

8 thoughts on “Script To Reboot Cisco Wireless Access Points Daily

  1. wayne

    somehow i am having hard time injecting the ‘reboot.sh’ and ‘uptime.sh’

    for the reboot, i had to do “<"
    as for the uptime.sh, i just cna't get the script to read the whole string.. it was only able to read 'get'.
    help?

    Reply
  2. wayne

    somehow i am having hard time injecting the ‘reboot.sh’ and ‘uptime.sh’

    for the reboot, i had to do “<"
    as for the uptime.sh, i just cna't get the script to read the whole string.. it was only able to read 'get'.
    help?

    Reply
  3. vhvx54

    What is Cialis? Cialis (tadalafil) relaxes muscles create in the walls of blood vessels and increases blood overspread to particular areas of the body. http://cialis.withoutadoctorprescriptions.com/ cialis without a doctor’s prescription is euphemistic pre-owned to regale erectile dysfunction (impotence) and symptoms of warm prostatic hypertrophy (enlarged prostate). Another brand of tadalafil is Adcirca, which is worn to study pulmonary arterial hypertension. Do not select Cialis while also winsome Adcirca, unless your doctor tells you to.

    Reply
  4. uvtq03

    Pharmacists be occupied in a mandatory place in the constitution provide for system, and while responsibilities http://pillserectiledysfunction.com/ over the counter ed pills vary mass the different areas of druggist’s vocation, the foot pursuit is that pharmacists ease patients get well and visit well. Pharmaceutical chemist responsibilities include a order of provide for for patients, from dispensing medications to monitoring diligent health and occurring to optimizing their reaction to medication.

    Reply
  5. KianSmall

    I have checked your website and i have found some duplicate content, that’s why you don’t rank high in google, but there is a tool that can help
    you to create 100% unique articles, search for; Boorfe’s tips unlimited content

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>