Setelah mencoba beberapa tutorial, akhirnya gue menemukan sebuah scripting dalam linux menggunakan tools #expext. Panjang memang, namun memudahkan gue setidaknya untuk melakukan restart keseluruh access point kantor. Berikut Scripting yang bisa gue sharing :
#!/usr/bin/expect
set timeout 20
spawn ssh rajawali@10.88.241.2
expect "Password:"
send "(password_device)\r"
expect "*>"
send "enable \r"
expect "Password:"
send "password_device\r"
expect "*#"
send "config term \r"
expect "*(config)#"
send "interface FastEthernet0/47 \r"
expect "*(config-if)#"
send "shut \r"
expect "*(config-if)#"
send "no shut \r"
expect "*(config-if)#"
send "do wr mem \r"
expect "*(config-if)#"
send "do ssh -l rajawali 10.88.241.3\r"
expect "Password:"
send "password_device\r"
expect "*>"
send "enable \r"
expect "Password:"
send "password_device\r"
expect "*#"
send "config term \r"
expect "*(config)#"
send "interface FastEthernet0/45 \r"
expect "*(config-if)#"
send "shut \r"
expect "*(config-if)#"
send "no shut \r"
expect "*(config-if)#"
send "interface FastEthernet0/46 \r"
expect "*(config-if)#"
send "shut \r"
expect "*(config-if)#"
send "no shut \r"
Tidak ada komentar:
Posting Komentar