Last active
November 9, 2019 18:20
-
-
Save o0-o/2f9877f38408eb6312b695c790ceab07 to your computer and use it in GitHub Desktop.
[Update the Firmware on a Ubiquiti Edgeswitch vi SSH] Non-interactive installation of firmware on a Ubiqiuti EdgeSwitch #ubiquiti #edgemax #switch #expect
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
#!/usr/bin/env expect | |
set timeout 720 | |
set host [lindex $argv 0] | |
set user [lindex $argv 1] | |
set password [lindex $argv 2] | |
set url [lindex $argv 3] | |
set ftp_pw [lindex $argv 4] | |
spawn bash -c "ssh -o StrictHostKeyChecking=no $user@$host" | |
expect "assword" | |
sleep 1 | |
send "$password\r" | |
expect " >" | |
send "enable\r" | |
expect " #" | |
send "copy $url backup\r" | |
expect "assword" | |
sleep 1 | |
send "$ftp_pw\r" | |
expect "(y/n)" | |
sleep 1 | |
send "y" | |
expect " #" | |
send "boot system backup\r" | |
expect " #" | |
send "reload\r" | |
expect "(y/n)" | |
sleep 1 | |
send "y\r" | |
send \033 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment