cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1788
Views
5
Helpful
1
Replies

SG300 10 Backup Script

markus.broder
Level 1
Level 1

Hello,

I have tested a script to backup the config from a SG300-10 switch but the script are not working.

I tested with plink, but I can connect to the switch but the command is not running.

Have someone a working script to backup the configuration from am Small Business Switch

I have over 20 SG300-10 and I want backup the config from time to time from all switches.

Have someone a working script where I can use?

Many Thanks for the help

Regars Markus

1 Reply 1

Brendan Kearney
Level 1
Level 1

linux shell script, requires the Cisco Small Business MiB:

#!/bin/bash

host=$1
string='secret'
mib=/usr/share/snmp/mibs/CISCOSBcopy.mib

case $2 in
    start | startup | startup_config )
    rlCopySourceFileType="3"  #3 for startup config, 2 for running config
    filename=$host\_$(date +%b.%d.%Y)_startup_config.txt
    ;;

    run | running | running_config )
    rlCopySourceFileType="2"  #3 for startup config, 2 for running config
    filename=$host\_$(date +%b.%d.%Y)_running_config.txt
    ;;

        * | "" | -h | --help | usage | --usage )
                echo "you must specify 2 parameters, host and config"
        echo ""
                echo "host would be the name of a switch that is to be backed up, sg300 or sg500"
        echo "config would be the name of the config to be backed up, running_config or startup_config"
                exit
        ;;
esac

rlCopyRowStatus="4"  #create and go
rlCopySourceLocation="1"  #local
rlCopySourceIpAddress="0.0.0.0"
rlCopySourceUnitNumber="1"  #unit number in stack
rlCopySourceFileName=""  #blank
rlCopyDestinationLocation="3"  #tftp
rlCopyDestinationIpAddress="192.168.88.1"  #tftp server ip
rlCopyDestinationUnitNumber="1"  #unit number in stack
rlCopyDestinationFileName=$filename

backup (){
snmpset -v2c -c $string -m +/usr/share/snmp/mibs/CISCOSBcopy.mib $host \
    rlCopyRowStatus.0 i $rlCopyRowStatus \
    rlCopySourceLocation.0 i $rlCopySourceLocation \
    rlCopySourceIpAddress.0 a $rlCopySourceIpAddress \
    rlCopySourceUnitNumber.0 i $rlCopySourceUnitNumber \
    rlCopySourceFileType.0 i $rlCopySourceFileType \
    rlCopyDestinationLocation.0 i $rlCopyDestinationLocation \
    rlCopyDestinationIpAddress.0 a $rlCopyDestinationIpAddress \
    rlCopyDestinationUnitNumber.0 i $rlCopyDestinationUnitNumber \
    rlCopyDestinationFileName.0 s $rlCopyDestinationFileName
}

backup