Back Up Cisco Catalyst 6500 Configuration

For the test, I sketched a Cisco Catalyst 6509-E automatic backup configuration script.

Actually the script itself:

# Backup CISCO config
sleep 5
echo "user"
sleep 4
echo "password"
sleep 4
echo "copy running-config tftp:"
sleep 2
echo ""
sleep 2
echo "cisco.cfg"
sleep 6

echo "exit"
) | telnet
mv /srv/tftp/cisco.cfg /backups/devices/cisco/`date +%Y-%m-%d`_cisco.cfg

find /backups/devices/cisco/ -type f -mtime +30 -exec rm {} \;

Add the contents of the script, for example, to the file and add it to cron, adding the following line to the /etc/crontab file:

0 2 * * * root /backups/scripts/ > /dev/null 2>&1

The file can be opened for example in the text editor nano (Ctrl+X to exit, y/n to save or cancel changes):

sudo nano /etc/crontab

The script connects via telnet to and copies the configuration to the tftp server, then the file is moved to a convenient directory for storage.
The last line in the script deletes files older than 30 days.
How to start the tftp server, see my articles: Installing and Configuring a TFTP Server in Ubuntu or Starting a TFTP server in Windows.
See also: Using and configuring CRON.

Script backup configuration DOCSIS ARRIS Cadant C3 CMTS

Actually, this is my script:

# Backup DOCSIS CADANTS config
sleep 5
echo "user"
sleep 5
echo "password"
sleep 5
echo "enable"
sleep 2
echo "password"
sleep 2
echo "copy startup-configuration tftp://"
sleep 5
echo "exit"
) | telnet
mv /srv/tftp/cadant1.xml /backups/devices/docsis/`date +%Y-%m-%d`_cadant1.xml

Where – cadant, – tftp server.

You can add the script to /etc/crontab for automatic execution (for example, every day at one in the morning):

0 1 * * * root /path/to/script/ > /dev/null 2>&1

Windows Server 2008 R2 Backup and Restore

For example, I will make a backup copy of Windows Server 2008 R2 and describe the process by items:

1) Open the “Server Manager”.

2) Select “Features” – “Add Features”, check “Windows Server Backup” and “Command-line Tools”, click the “Install” button and wait for the installation to complete.

3) Open the “Start” menu and select “Windows Server Backup”.
For the test, I clicked “Backup Once”, in the window that appears, I select the “Custom” configuration type and ticked the C drive and all the oslat except for the other local disks if they are (for example, drive D) in the next window, you can select the storage type where the backup a copy, for example “Local disks” and specify drive D, or “Remote shared folder” and specify the path, I was just running Samba on one of the Linux servers, so I connected the network folder and chose this option.
See also my article – Installing and Configuring Samba on Linux

After the process is complete, the folder “WindowsImageBackup” with a backup will appear on the disk or network share.

To restore the system from this backup, you can similarly click the “Start” – “Windows Server Backup” menu and select this backup, or if the server does not start, then start the Windows startup disk, select “System Restore” and specify this backup.

Backup configuration of MikroTik

You can make a backup copy of the configuration of MikroTik devices in several ways:

1) Via the web interface or WinBox on the left in the menu select Files and press the Backup key and once again Backup, after which a file with a backup copy of the settings will be created in the device memory. For example, after resetting the device’s settings, you can restore them from this file, open Files there, select the desired file and click the Restore button, the device will reboot.
From the terminal, look at the list of files in memory, make a backup and recover from it like this:

file print
system backup save name=file
system backup load name=file

From this file, you can restore only on the device where it was made, because the mac addresses of the interfaces are also restored.

2) The next option is to export the configuration (the list of commands) to a file, which you can then execute on other devices, thereby transferring the configuration.
I wrote about this in the next article How to view the configuration of MikroTik

Backup configuration of TP-Link switches

I wrote a script for backup configuration of TP-Link switches.
The script runs on Linux where the TFTP server is running, it is connected via telnet to the switch and the configuration command is sent to the specified TFTP, when the telnet connection is closed, the file is moved to the desired directory, and the last command deletes files longer than 30 days, as more of them I do not need to store.
You can also make a copy of all the files in the cloud every month.
As you can see, before entering a password in the script, you can not pause.

echo "PASSWORD";
echo "enable";
echo "PASSWORD";
echo "copy startup-config tftp ip-address filename tplink";
sleep 2;
echo "exit";
sleep 1;
echo "exit";
} | telnet

mv /srv/tftp/tplink.cfg /backups/devices/tplink/`date +%Y-%m-%d`_tplink.cfg
find /backups/devices/tplink/ -type f -mtime +30 -exec rm {} \;

Redmine Backup

Create a script (in the text editor nano Ctrl+X to exit, y/n to save or cancel changes):

sudo nano /etc/cron.daily/redmine

Sample script content:

/usr/bin/mysqldump -u root -p<password> redmine_default | gzip > /path/to/backups/redmine_db_`date +%y_%m_%d`.gz
rsync -a /var/lib/redmine/default/files /path/to/backups/files

Let’s make the script executable:

chmod +x /etc/cron.daily/redmine

In the script, you can also add the command to delete old files or directories so that the disk does not overflow, see my article – Script to delete old files

See also other my articles about backup – Backup