Script to Backup Linksys Wireless Access Point Configurations
4815 Views, 15 Favorites, 0 Comments
Script to Backup Linksys Wireless Access Point Configurations
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
I am going to assume you have a linux or os x system at your disposal. Although cygwin would work fine.
Variables
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
#!/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
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
#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
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
#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
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
#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