Script Telnet

i want automatic script to add in schedule like that

[sys@MikroTik] > system telnet 192.168.1.1
Trying 192.168.1.1…
Connected to 192.168.1.1.
Escape character is ‘^]’.
Login: admin
Password: admin

reboot

that script will reboot router DSL

I don’t think you can automate it with Telnet (somebody correct me if I’m wrong), but there are other ways: http://forum.mikrotik.com/t/scripts-that-interact-between-different-mikrotik-routers/63478/1

“telnet” is interactive, you cannot run it from routeros script to execute commands. SSH can be used for such tasks.

thanks , can u make script use ssh to reboot it plz

First, you will need to use DSA keys for this to be automated: http://wiki.mikrotik.com/wiki/Use_SSH_to_execute_commands_(DSA_key_login)

Then you can use this script to send the reboot command:
/system ssh 192.168.1.1 user=admin “/system reboot”;

Thanks alot Skot

DSA Keys in new terminal or where ???!!!

I have MikroTik v3.30 on PC

Are you trying to send commands from one MikroTik to another MikroTik? Or something else?

You will have to follow the instructions to create the 2 DSA key files (on a linux/bsd/whatever computer), then upload them to the router (using ftp, or with winbox drag and drop into the files window). If this is between 2 MikroTiks, then you’ll upload the public key to the receiving router, and the public and private to the sending router, and then run the corresponding commands to import the keys.

Could you help me, I need to telnet into the modem and restart it

As written much earlier that does not work with telnet. You need to use SSH and yhese dsys we use RSA instead of DSA.