TP-Link VPN 负载均衡器路由器 TL-ER604W 的预定重启脚本

问题描述 投票:0回答:1

如何安排重启路由器型号 TP-Link VPN 负载均衡路由器 TL-ER604W ?

cron router expect telnet schedule
1个回答
0
投票

回答问题;首先,这要求您必须通过 telnet 连接。

然后只需在 Debian GNU/linux 上安装 expecttelent

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"
© www.soinside.com 2019 - 2024. All rights reserved.