How to clean shutdown Nerves

I have Nerves running on a Raspberry pi 3. Is there a nice way to perform a clean shutdown nerves or cutting the power is the only way?

1 Like

Hello Snake-Sanders,

Nerves.Runtime.halt()

Is what you are looking for.

Even more easier is to add an ā€˜import Nerves.Runtimeā€™ to the rootfs_overlay/etc/iex.exs script, which will allow you to just use ā€˜haltā€™.

Kind regards,

Jochen

4 Likes

yes, thank you so much!

I reach this post with the same issues than @Snake-Sanders, but I tried Nerves.Runtime.halt(), but this one restarted the Raspberry (B+ 1.2). In my case I have to use Nerves.Runtime.poweroff(). I read the documentation for halt/0 and poweroff/0, but I donā€™t understand the one for the first: ā€œHalt the device (meaning hang, not power off, nor reboot)ā€.

Does someone knows what means ā€œhangā€ on this context? It seems like ā€œsuspendā€ or something else, although the behaviour in my case is more like ā€œrestartā€.

1 Like