如何安排重启路由器型号 TP-Link VPN 负载均衡路由器 TL-ER604W ?
回答问题;首先,这要求您必须通过 telnet 连接。
然后只需在 Debian GNU/linux 上安装 expect 和 telent
sudo apt install expect telnet
然后将以下脚本保存为您喜欢的任何文件名,并使用 crontab 配置它以安排它。
#!/usr/bin/expect -f
set timeout 5
set username "admin"
set password "myp@ssw0rd"
set enabled_password "myp@assw0rd"
spawn telnet 192.168.1.254
expect "Username:"
send "$username\r"
expect "Password:"
send "$password\r"
sleep 1
expect "TP-LINK > "
send "enable\r"
expect "Enter password:"
send "$enabled_password\r"
expect "TP-LINK # "
send "sys reboot\r"
expect "This command will reboot system, Continue? \[Y/N\]: "
send "y\r"