Motivation
How to
You need to install the "expect"-script language.
You can use the following script to force your modem to reconnect:
#!/usr/bin/expect set timeout 1 set cmd {uname -a} spawn ssh Telek0m@10.0.0.138 expect_after eof { exit 0 } ## interact with SSH expect "yes/no" { send "yes\r" } expect "password:" { send "<the-password>\r" } expect "OpenRG> " send "conf\r" expect "conf> " send "set /dev/ppp0/enabled 0\r" expect "conf> " send "reconf 1\r" expect "conf> " send "set /dev/ppp0/enabled 1\r" expect "conf> " send "reconf 1\r" expect "conf> " send "exit\r" expect "OpenRG> " send "exit\r"
The "Telek0m"-user that is used for the SSH-connection was used in earlier firmwares as universal support-user. As I'm not sure how legal it is to provide the password here, I'll just skip it (you'll find it using a good search engine).
make sure the script is executable
# chmod +x reconnect.exp
and put it in a cronjob
# crontab -e 0 5 * * * /path/to/reconnect.exp
That's it.
Keine Kommentare:
Kommentar veröffentlichen