I’ve been searching for a working solution to remotely shutdown/restart Sonarr for quite a while.
I couldn’t find one and with the knowledge I gained from the articles I read about the subject I started tinkering and finally found a solution.
Enter cUrl.
Sonarr shutdown:
curl --data "{apikey:[YOUR-API-KEY]}" http://[YOUR-SERVER-ADDRESS]:[YOUR-PORT]/api/system/shutdown?apikey=[YOUR-API-KEY]
Sonarr Restart:
curl --data "{apikey:[YOUR-API-KEY]}" http://[YOUR-SERVER-ADDRESS]:[YOUR-PORT]/api/system/restart?apikey=[YOUR-API-KEY]
Prerequisites:
- Install cUrl
- Add cUrl to your system’s environment PATH variable
- Replace:
[YOUR-API-KEY] with the api key you configured in Settings->General->Security
[YOUR-SERVER-ADDRESS] with your server address (IP address or computer name)
[YOUR-PORT] with the port number you configured in Settings->General->Start-Up
Examples:
curl --data "{apikey:dtoj40rztfedbj6895jyg4ansq1fm3q9}" http://192.168.0.255:8989/api/system/shutdown?apikey=dtoj40rztfedbj6895jyg4ansq1fm3q9
curl --data "{apikey:dtoj40rztfedbj6895jyg4ansq1fm3q9}" http://192.168.0.255:8989/api/system/restart?apikey=dtoj40rztfedbj6895jyg4ansq1fm3q9
I have no idea why the apikey needs to be used twice. I tried using them once. Only as a data parameter and only as a querystring but both attempts failed.
I welcome any comments
I created two batch files (.bat on my Windows 10 system) which I run to execute the tasks.
I thought it might come in handy for folks that are also searching for this.