Community discussions

MikroTik App
 
teleport
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 78
Joined: Mon Sep 07, 2020 11:51 pm

command line options for reboot

Wed May 07, 2025 10:53 pm

using RB260 and there is no specific command line to reboot. is there a way to send http requests via script with credentials. working sample would help for rb260
 
User avatar
patrikg
Member
Member
Posts: 419
Joined: Thu Feb 07, 2013 6:38 pm
Location: Stockholm, Sweden

Re: command line options for reboot

Wed May 07, 2025 11:03 pm

You could do it like this, maybe I am thinking wrong here...I don't know how SwOS handle that.

This is on RouterOS:

On Linux:
curl -k -u admin:password -X POST http://192.168.88.1/rest/system/reboot -H "content-type: application/json"
On Windows:
curl.exe -k -u admin:password -X POST http://192.168.88.1/rest/system/reboot -H "content-type: application/json"
And here's how you could to try (with SwOS):
1. Log in to the switch’s web interface.
2. Navigate to the page where you normally click "Reboot."
3. Right-click the Reboot button and select Inspect to open the developer tools.
4. Look at the request being sent when you click the reboot button.
5. You might see a URL like this:
http://192.168.88.1/link.tst?reboot=Reboot
6. If that’s the case, you can try a curl command like this (replace IP, username, and password):

On Linux:
curl -u admin:password "http://192.168.88.1/link.tst?reboot=Reboot"
On Windows:
curl.exe -u admin:password "http://192.168.88.1/link.tst?reboot=Reboot"
 
teleport
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 78
Joined: Mon Sep 07, 2020 11:51 pm

Re: command line options for reboot

Wed May 07, 2025 11:32 pm

have tried some flavors of above (and taking sample from network section/developer tools of browser )and gives me a not authorized. working version would be great
 
User avatar
karlisi
Member
Member
Posts: 480
Joined: Mon May 31, 2004 8:09 am
Location: Latvia

Re: command line options for reboot

Thu May 08, 2025 12:54 pm

Perahaps this?
curl.exe "http://admin:password@192.168.88.1/link.tst?reboot=Reboot"
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 4873
Joined: Sun May 01, 2016 7:12 pm
Location: California
Contact:

Re: command line options for reboot

Fri May 09, 2025 6:54 am

Either should work...

It could be the password has characters that require escaping. try using quotes "" in the curl -u "user:password" ...
(or url-encoding if using http://user:password@ scheme)

SwOS has no default gateway, so you have to be on same LAN segment for it to work, it cannot be routed (unless NAT'ed).