Restart container regularly

Hello,
is there a chance to restart a container regularly, e.g. once per hour?
regards,
Thomas

Hi @thomasw

you can use the supervisor API: https://docs.resin.io/reference/supervisor/supervisor-api/#post-v1-restart

You can call it periodically from a new container (microservices approach) or from a new process (if you are using a classic application).

Best,
Javi

Where can I find the Auth Token for the external call?

I used the token from preference, but I only receive error:

root@heimserver:/home/thomas# curl -X POST --header “Content-Type:application/js on” --header “Authorization: Bearer xxx” --data ‘{" uuid": xxx, “data”: {“appId”: xxx}}’ “https://a pi.resin.io/supervisor/v1/restart

Error
Bad Request

I tried myself using curl and it worked for me. I used the token from preference too.

It comes to my mind that it is probably a quotation marks problem. Note the quotes in the uuid and appId values.

curl -X POST --header "Content-Type:application/json" --header "Authorization: Bearer XXXXXXXXXX" --data '{"uuid": "XXXXXX", "data": {"appId": "XXXXX"}}' "https://api.resin.io/supervisor/v1/restart"

Hi, with values in “” it works. Regarding to the documentation that was not clear for me.

For the benefit of any future audience it looks as though the forums software has “corrected” thomasw’s quotes to smart quotes. The straight quote in jcozar’s response are the ones to copy.