Script to Backup Linksys Wireless Access Point Configurations

by joe in Circuits > Wireless

4815 Views, 15 Favorites, 0 Comments

Script to Backup Linksys Wireless Access Point Configurations

linksys_wrt54g.jpg
This instructable will show a script that can be used to automate the backup of linksys wireless access point configurations. Actually this can easily be edited to backup almost any linksys device.

Requirements

f11release.png
I am going to assume you have a linux or os x system at your disposal. Although cygwin would work fine.

Variables

1.jpg
Lets first set some variables. Edit all of these to match your environment.

#!/bin/bash
#Joe McManus
#backup linksys firewall

#set some variables
hostname=wrt54g.foo.bar.com
basedir=/data/network-backups
user=userame
pass=password
mailto=joe@foo.com

Get Config

2.jpg
This bit uses wget to download the config and save as hostname-date.config.bin

#Get the config and save as hostname-date.config.bin
wget https://$hostname/Config.bin --user=$pass --password=$pass --no-check-certificate -O $basedir/$hostname-`date +%Y-%m-%d`.config.bin

Check to See If It Worked

3.jpg
We now check to see if it worked, send email if not.

#check to see if it worked
if [$? != 0]
then
echo "Error: Backup failed"
mail -s"Error: Backup of $hostname failed at `date`" $mailto </dev/null
fi

Put It All Together

4.jpg
Put it all together and run it. If it works add it to crontab. The full script is attached.
#Joe McManus
#backup linksys firewall

#set some variables
hostname=wrt54g.foo.bar.com
basedir=/data/network-backups
user=userame
pass=password
mailto=joe@foo.com

#Get the config and save as hostname-date.config.bin
wget https://$hostname/Config.bin --user=$pass --password=$pass --no-check-certificate -O $basedir/$hostname-`date +%Y-%m-%d`.config.bin

#check to see if it worked
if [$? != 0]
then
echo "Error: Backup failed"
mail -s"Error: Backup of $hostname failed at `date`" $mailto </dev/null
fi

Downloads