Enabling 4g on rasberry pi using bash commands

Hi,

I’m currently researching on what the best way is to deploy my app on Balena OS.
What important is for my code is that the 4G connection is always enabled before starting docker images. What I do is execute bash commands that communicate with ttyAMA0 and send AT commands. After that I use libqmi-utils to activate an wwan0 connection for direct 4G internet.

This code must be running no matter what. Normally this bash command is added to /etc/rc.local. I’ve discovered that I cannot sudo and modify outside the docker containers.

I was wondering what the best option for me is to be sure that the bash app is running no matter what? And is executed before the containers are activated?

Thanks in advance!

Hi,
Unfortunately it is not possible today to run custom code in the underlying hostOS. We have a feature called host apps that will allow for this, this is planned for somewhere mid next year.
But maybe we can go around your need to run code on the hostOS, could you explain in a bit more detail why you need to enable the 4G connection before any containers run?
Kind regards,
Theodor

Hi,

Thank you for your answer. I want it to connect just like a regular wifi connection. If I deploy this inside an container, and something goes wrong, the device cannot communicate with the balena server anymore and the container cannot be reverted back to an old one.

Thanks for the additional info. Indeed as telphan answered, its not yet possible but there is active work on a feature we call “hostApps” where one will be able to add functionality to the OS, but today its not possible. You can track it here: https://trello.com/c/2CjPzxJ0/11-hostapp but hopefully we will add more colour to that over the coming months.