Script to Backup Linksys Wireless Access Point Configurations
4826 Views, 15 Favorites, 0 Comments
Script to Backup Linksys Wireless Access Point Configurations
![linksys_wrt54g.jpg](/proxy/?url=https://content.instructables.com/FCF/BCUS/FX23VF38/FCFBCUSFX23VF38.jpg&filename=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](/proxy/?url=https://content.instructables.com/FI5/UUOX/FX23VF3Y/FI5UUOXFX23VF3Y.png&filename=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](/proxy/?url=https://content.instructables.com/FLN/43RI/FX23VEXL/FLN43RIFX23VEXL.jpg&filename=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
#!/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](/proxy/?url=https://content.instructables.com/FMD/OARS/FX23VF0P/FMDOARSFX23VF0P.jpg&filename=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
#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](/proxy/?url=https://content.instructables.com/FLM/ZNY2/FX23VF11/FLMZNY2FX23VF11.jpg&filename=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
#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](/proxy/?url=https://content.instructables.com/FNV/3JZW/FX23VF2G/FNV3JZWFX23VF2G.jpg&filename=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
#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