# Restarting device from within application

**URL:** <https://forums.balena.io/t/restarting-device-from-within-application/255046>\
**Category:** Project help\
**Tags:** docker, raspberrypizero\
**Created:** [February 13, 2021, 12:44pm UTC](https://forums.balena.io/t/restarting-device-from-within-application/255046 "2021-02-13T12:44:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Winkelmann](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/winkelmann/32/2419_2.png) [@Winkelmann](https://forums.balena.io/u/Winkelmann)\
**Post date:** [February 13, 2021, 12:44pm UTC](https://forums.balena.io/t/restarting-device-from-within-application/255046/1 "2021-02-13T12:44:33Z")

</div>

Hi,

I know what I am asking about is a listed anti pattern :

> **[Development Anti-patterns - Balena Documentation](https://www.balena.io/docs/learn/more/anti-patterns/#creating-a-reboot-loop)**

However, and I had the same issue before using OpenBalena, sometimes, the raspberry pi zero looses network access for no reason. I wasted too much time already trying to figure out a logical reason for this problem. The fix I implemented previously was a simple check every once in a while for network access (both DNS and my personal server), and if there is none, I just restart the device.  
It’s really a simple solution that guaranties the minimum downtime.

**My problem is as follow: How do I restart the device from within my Docker application ?**

I cannot call `shutdown` or `/sbin/shutdown`. Why is that ? How can I request a shutdown differently ?

Thanks in advance for your help.  
Tim Winkelmann

---

<div class="post-metadata">

**Author:** ![mbalamat](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mbalamat/32/1245_2.png) [@mbalamat](https://forums.balena.io/u/mbalamat)\
**Post date:** [February 15, 2021, 2:03pm UTC](https://forums.balena.io/t/restarting-device-from-within-application/255046/5 "2021-02-15T14:03:49Z")

</div>

Hello you probably want something like this [Interacting with the balena Supervisor - Balena Documentation](https://www.balena.io/docs/reference/supervisor/supervisor-api/#examples-3) .

---

<div class="post-metadata">

**Author:** ![mbalamat](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mbalamat/32/1245_2.png) [@mbalamat](https://forums.balena.io/u/mbalamat)\
**Post date:** [February 15, 2021, 2:06pm UTC](https://forums.balena.io/t/restarting-device-from-within-application/255046/6 "2021-02-15T14:06:37Z")

</div>

So the way to do what you describe is to interact with the supervisor.

---

<div class="post-metadata">

**Author:** ![Winkelmann](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/winkelmann/32/2419_2.png) [@Winkelmann](https://forums.balena.io/u/Winkelmann)\
**Post date:** [February 18, 2021, 5:37pm UTC](https://forums.balena.io/t/restarting-device-from-within-application/255046/8 "2021-02-18T17:37:52Z")

</div>

Hey,

I implemented the reboot by calling the supervisor. Thanks for the tip.

Tim

---

<div class="post-metadata">

**Author:** ![Ereski](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Ereski](https://forums.balena.io/u/Ereski)\
**Post date:** [February 18, 2021, 5:43pm UTC](https://forums.balena.io/t/restarting-device-from-within-application/255046/9 "2021-02-18T17:43:23Z")

</div>

Glad it’s working 🙂
