Configuration Scripting Commands
Use these commands to generate, apply, and manage configuration script files.
Configuration Scripting allows you to generate text-formatted script files representing the current configuration of a system. You can upload these configuration script files to a PC or UNIX system and edit them. Then, you can download the edited files to the system and apply the new configuration. You can apply configuration scripts to one or more switches with no or minor modifications.
Use the show running-config command (see show running-config) to capture the running configuration into a script. Use the copy command (see copy) to transfer the configuration script to or from the switch.
Use the show command to view the configuration stored in the startup-config, backup-config, or factory-defaults file (see show startup-config | backup-config | factory-defaults).
Use scripts on systems with default configurations; however, you are not prevented from applying scripts on systems with non-default configurations.
Scripts must conform to the following rules:
- For an M4350 series switch, script files are not distributed across the stack and remain only in the unit that is the primary management unit at the time of the file download.
- The file extension must be “.scr”.
- A maximum of ten scripts are allowed on the switch.
- The combined size of all script files on the switch shall not exceed 2048 KB.
- The maximum number of configuration file command lines is 2000.
You can type single-line annotations at the command prompt to use when you write test or configuration scripts to improve script readability. The exclamation point (!) character flags the beginning of a comment. The comment flag character can begin a word anywhere on the command line, and all input following this character is ignored. Any command line that begins with the “!” character is recognized as a comment line and ignored by the parser.
The following lines show an example of a script:
! Script file for displaying management access
show telnet !Displays the information about remote connections
! Display information about direct connections
show serial
! End of the script file!
To specify a blank password for a user in the configuration script, you must specify it as a space within quotes. For example, to change the password for user jane from a blank password to hello, the script entry is as follows:
users passwd jane
" "
hello
hello
script apply
M4250
M4350
This command applies the commands in the script to the switch. The scriptname argument is the name of the script to apply.
| Format | script apply scriptname |
| Mode | Privileged EXEC |
script delete
M4250
M4350
This command deletes a specified script where the scriptname argument is the name of the script to delete. The all option deletes all the scripts present on the switch.
| Format | script delete {scriptname | all} |
| Mode | Privileged EXEC |
script list
M4250
M4350
This command lists all scripts present on the switch as well as the remaining available space.
| Format | script list |
| Mode | Privileged EXEC |
| Term | Definition |
|---|---|
| Configuration Script | Name of the script. |
| Size | Privileged EXEC |
script show
M4250
M4350
This command displays the contents of a script file, which you specify with the scriptname argument.
| Format | script show scriptname |
| Mode | Privileged EXEC |
| Term | Definition |
|---|---|
| Output Format | line number: line contents |
script validate
M4250
M4350
This command validates a script file by parsing each line in the script file, in which scriptname is the name of the script to validate. The validate option is intended to be used as a tool for script development. Validation identifies potential problems. It might not identify all problems with a specified script on all devices.
| Format | script validate scriptname |
| Mode | Privileged EXEC |
script dhcpclient-config list
M4250
M4350
This command displays the DHCP client configuration files, including the file names and file sizes.
| Format | script dhcpclient-config list |
| Mode | Privileged EXEC |
script dhcpclient-config show
M4250
M4350
This command displays the contents of a specific DHCP client configuration file (cfgfilename), including the file names and file sizes.
| Format | script dhcpclient-config show cfgfilename |
| Mode | Privileged EXEC |
script dhcpclient-config delete
M4250
M4350
This command deletes a specific DHCP client configuration file (cfgfilename) or all DHCP client configuration files.
| Format | script dhcpclient-config delete {cfgfilename | all} |
| Mode | Privileged EXEC |