reboot another mikrotik from mikrotik device

Hello,
i try to reboot a local mikrotik device from another mikrotik.
unfortunately i don’t have a linux box with curl or ssh to script and crontab.

so i thought 2 ways…
ssh and rest api

  1. rest api i use
/tool/fetch url=https://192.168.1.211:10443/rest/system/scripts/reboot check-certificate=no mode=https user=admin password="mypassword" http-method=get
 status: failed
failure: closing connection: <400 Bad Request> 192.168.1.211:10443 (4)

instead with https://192.168.1.211:10443/rest/system/scripts/resource works fine.

or i create a script

:execute {/system reboot;}

but how i can run that script with fetch?

another way is ssh.
so i can create ssh keys and put public on mikrotik to restart. (in system users ssh key import public)
and import in “master” device in system users ssh private key.
but in terminal i can’t select ssh private key…

/system/ssh address=192.168.1.211 port=22 user=admin

and then?

i think most convenient use rest api, but i can’t understand how integrate with fetch instead curl…

thank you

You have curl.exe and ssh.exe and scp.exe in windows, and you have at.exe…

at 23:00 /every:M,T,W,Th,F cmd /c "curl.exe https://192.168.1.211:10443/rest/system/scripts/reboot"

And you maybe start the Scheduler.

net start "task scheduler"

And you view the scheduler task just run

at

Thank you.
But i don’t have Windows server.
So i can’t use on Windows PC…

I would reboot lte wap from hap ac3…

Thank you

ok i see..i think you need to change the content type like this…

http-header-field="Content-Type: application/json"



/tool/fetch url=https://192.168.1.211:10443/rest/system/scripts/reboot check-certificate=no mode=https user=admin password="mypassword" http-method=get http-header-field="Content-Type: application/json"

And maybe change http-method=get to post.

Won’t ssh-exec do?
https://wiki.mikrotik.com/wiki/Manual:System/SSH_client

http://forum.mikrotik.com/t/reboot-command-to-network-device-from-rb/149232/1