this post was submitted on 17 May 2025
8 points (83.3% liked)
Arch Linux
8835 readers
2 users here now
The beloved lightweight distro
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Nice. I will try the systemd unit. Meanwhile, i have added a loop in the script, which helps a little bit:
In my test, this exits the script after 15 seconds without connection, but continues, when the connection is available or is established within this time.
But i think, its a nice idea, to add this to the script AND use the systemd unit together.
With these kinds of things, where you need to manage state (waiting, executing, failed, etc), it is very easy to miss a case or transition and generally better to rely on proven tech.
Let the waiting for network connection and retrying be done by systemd, half the internet runs on it. You can trust that it won't mess that part up. Write only what is specific to you in your script.