Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/expect -f
- set timeout 20
- set IPaddress "192.168.10.2"
- set Username "user"
- set Password "password"
- set Directory /home/Desktop/logs
- #send_log "### /START-SSH-SESSION/ IP: $IPaddress @ [exec date] ###\r"
- spawn ssh -o "StrictHostKeyChecking no" $Username@$IPaddress
- expect "*assword: "
- send "$Password\r"
- expect "#"
- send "conf t\r"
- expect "(config)#"
- send "int g0/11\r"
- expect "(config-if)#"
- send "shut\r"
- expect "(config-if)#"
- sleep 30
- send "no shut\r"
- expect "(config-if)#"
- send "exit\r"
- expect "(config)#"
- send "exit\r"
- expect "#"
- send "exit\r"
- #sleep 1
- #send_log "\r### /END-SSH-SESSION/ IP: $IPaddress @ [exec date] ###\r"
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement