# Restart container regularly

**URL:** <https://forums.balena.io/t/restart-container-regularly/3762>\
**Category:** Product support\
**Created:** [August 19, 2018, 11:55am UTC](https://forums.balena.io/t/restart-container-regularly/3762 "2018-08-19T11:55:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomasw](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@thomasw](https://forums.balena.io/u/thomasw)\
**Post date:** [August 19, 2018, 11:55am UTC](https://forums.balena.io/t/restart-container-regularly/3762/1 "2018-08-19T11:55:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jcozar](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jcozar/32/472_2.png) [@jcozar](https://forums.balena.io/u/jcozar)\
**Post date:** [August 20, 2018, 6:50am UTC](https://forums.balena.io/t/restart-container-regularly/3762/4 "2018-08-20T06:50:03Z")

</div>

Hi @thomasw

you can use the supervisor API: [https://docs.resin.io/reference/supervisor/supervisor-api/#post-v1-restart](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

---

<div class="post-metadata">

**Author:** ![thomasw](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@thomasw](https://forums.balena.io/u/thomasw)\
**Post date:** [August 24, 2018, 11:26am UTC](https://forums.balena.io/t/restart-container-regularly/3762/7 "2018-08-24T11:26:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![thomasw](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@thomasw](https://forums.balena.io/u/thomasw)\
**Post date:** [August 24, 2018, 12:05pm UTC](https://forums.balena.io/t/restart-container-regularly/3762/8 "2018-08-24T12:05:47Z")

</div>

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](https://a)[pi.resin.io/supervisor/v1/restart](http://pi.resin.io/supervisor/v1/restart)”

Error
```
Bad Request
```

---

<div class="post-metadata">

**Author:** ![jcozar](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jcozar/32/472_2.png) [@jcozar](https://forums.balena.io/u/jcozar)\
**Post date:** [August 26, 2018, 9:05pm UTC](https://forums.balena.io/t/restart-container-regularly/3762/10 "2018-08-26T21:05:00Z")

</div>

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.**

```auto
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"

```

---

<div class="post-metadata">

**Author:** ![thomasw](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@thomasw](https://forums.balena.io/u/thomasw)\
**Post date:** [August 28, 2018, 1:36pm UTC](https://forums.balena.io/t/restart-container-regularly/3762/11 "2018-08-28T13:36:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sqweelygig](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/sqweelygig/32/150_2.png) [@sqweelygig](https://forums.balena.io/u/sqweelygig)\
**Post date:** [August 31, 2018, 2:18pm UTC](https://forums.balena.io/t/restart-container-regularly/3762/12 "2018-08-31T14:18:58Z")

</div>

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.
