automatic reboot from container offline device

Hi!

Anyone has an advice on how to make an rpi3/4 automatically reboot while is offline from an ubuntu/alpine container?

Thanks :slight_smile:
Matteo

Hi,

You can reboot using a call to supervisor.

You will likely need to provide to provide your own connectivity checks.

Do be VERY careful with this, you don’t want your device to get stuck in a reboot loop, with no way recover.
I’d suggest waiting at least 5 minutes before deciding to reboot, just so you can log in through UART or something and stop the reboot from happening so you can properly troubleshoot the device.

so you don’t need an internet connection to do this kind of Curl requests?

I have an offline device that each 12 hours does this kind of post request

curl -X POST --header "Content-Type:application/json" \
    "$BALENA_SUPERVISOR_ADDRESS/v1/reboot?apikey=$BALENA_SUPERVISOR_API_KEY"

in order to prevent long uptimes and in the case it looses its internet connection it can reboot and try again, but it doesn’t seems to work with an offline one …

Am i wrong about it then?

Hi,

This should work for offline devices as well.
How are you testing this?

Note that if you have multiple services running, you will need to include the appropriate label (io.balena.features.supervisor-api)

1 Like

@matteopeluso did this work for you?

Thank you for your help @TJvV :slight_smile:

Hi! It’s seems like it worked, but even if I’ve inserted the command in a cronlog it seems like sometimes the reboot kills the device and never come back online …