回答问题;首先,这将要求您必须通过telnet进行连接。
然后只需安装
预料
和
电传
在Debian GNU/linux上
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"