Reboot IP LDK over telnet from bash script
Зависимости: expect
sudo apt-get install expect
#!/usr/bin/expect set hostName [lindex $argv 0] set LdkPCAdminPass [lindex $argv 1] spawn telnet $hostName send "\r" expect "ENTER PASSWORD:" send "brandy\r" expect "maint>" sleep 2 send "reboot\r" expect "Password:" send "$LdkPCAdminPass\r" expect "Retype password:" send "$LdkPCAdminPass\r";
./foo.sh hostname LdkPCAdminPass
$ ./foo.sh 192.168.14.253 1234 spawn telnet 192.168.14.253 Trying 192.168.14.253... Connected to 192.168.14.253. Escape character is '^]'. Welcome to ipLDK-60 system. Press enter. Your address is 192.168.100.194. Your port number is 3. ipLDK-60 System Version GS88P-3.8Ib OCT/11 Dsp Version: 5.8(11/04/20),(A-law) DATE: 10/23/18 TIME: 11:26:24 SITE NAME : ENTER PASSWORD: brandy ****** maint> reboot reboot ## Reboot System ## CAUTION!! This reboots the system. Admin password should be typed. Password: 1234 ****
Только авторизованные участники могут оставлять комментарии.