I have a Raspberry Pi and run a server on it (Python Script). I would like the server to restart when it goes down. I did a little googling and found out that the easiest way to do this is by using the systemd service units and the option Restart=always. So I created a service for my python script and started it. Everything worked fine.
But here is my problem, when I restart the Raspberry Pi, the service is running too early and the server (Python script) cannot assign the correct IP address. It only uses the local-host IP address 127.0.0.1 (The server must be accessible by other computers on the network).
In the best case the service should also wait until a GSM module connected to the Raspberry Pi is started.
My question is now is there a possibility that the service waits for the right IP address to be available and maybe even waits until the GSM module is initialized?
I already tried to create a .socket file for the service but I didn't seem to know how to set it up correctly.
Hopefully you guys can help me :)