Created
October 11, 2017 12:56
-
-
Save aaronmelton/929d307ab9cde56deeeec22f43eca306 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Script: Router Update Script | |
| ## Author: aaron@aaronmelton.com | |
| ## Version: 1.2 | |
| ## Created: 2012-03-12 | |
| ## Updated: 2012-03-13 | |
| ## Description: This script provides the ability to securely copy a Cisco IOS | |
| ## file to a Cisco router and then instruct the router to copy | |
| ## the contents of the file into the running-config. | |
| #!/usr/bin/expect | |
| ## Define script environment variables | |
| set user cisco | |
| set password cisco | |
| set router 192.168.1.1 | |
| set file routerUpdate.txt | |
| ## Secure-copy file to Cisco router's flash memory | |
| spawn scp $file $user@$router:flash:$file | |
| expect "Password:" | |
| send "$password\r" | |
| ## Instruct Cisco router to copy uploaded file from router's flash memory into | |
| ## running-config | |
| spawn ssh -l $user $router "copy flash:$file system:running-config" | |
| expect "Password:" | |
| send "$password\r" | |
| expect "? " | |
| send "\r" | |
| ## Return to shell prompt | |
| interact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment