Scripting automatic reload of network equipment

I came across a Meru WLC that required a weekly boot, and unfortunately, there is no command to schedule reboots
Nor did the customer have any Management Systems that could sort this out.

The solution, albeit not a very pretty one, was to utilize plink in a script and run that script as a scheduled task.
One critical drawback is that the password for the account is saved in clear text in a command-file.

#
# Script that passes commands to the Meru-controller utilizing plink.exe
# The purpose of the script is to restart the Meru Controller on a weekly basis.
# The script must be invoked through scheduled tasks to automate the reboot.
# Version: v1.0-20160601, Gos @ networkoc.net
#
@echo on
cd “C:\admin\scripts\boot”
plink.exe -ssh 10.10.10.10 -l admin -pw ClearTextPassword < meru-command-list.txt > plink-output.txt

The documentation of plink states using the -m switch to grab commands off a text file, but Meru did not manage to handle multiple lines.
Instead Redirection was used, which simply does “Type a text file and pass the text to command”[1].

The meru-command-list.txt does the following. The last two commands should not be needed, but I’ve included them nonetheless.

date
reload controller
y
exit

On a Windows machine I scheduled this a basic task, running weekly in the middle of the night. Remember to remove any of the parameters for retrying in case of failure, so the script does not all of a sudden run in the middle of a production time frame. =)

References:
[1] http://ss64.com/nt/syntax-redirection.html

5.00 avg. rating (99% score) - 1 vote

Leave a Reply

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