Jeremy Ardley wrote: > I have noticed a problem with haproxy on an edge router after a power > outage. > > The service is configured to start automatically, but usually it takes a bit > of time for the internet connection to be established and an IP assigned to > the WAN interface. > > haproxy seems to keep trying for 5 times, but then stops when it still > hasn't got a properly configured interface to bind with. > > I'm interested in strategies or configuration options to get it to keep > retrying, perhaps at an extended interval? > > My WAN interface is configured using systemd-networkd (as is my LAN > interface)
Your start requirement is not "the network is up" but "we can talk to the Internet". What's a good proof of that? Perhaps it is being able to contact something that is so reliable, you expect it always to be available. If I were doing this casually, I might decide that one of the DNS services run by a massively-distributed BGP anycast should be up all the time, and that getting a good result from 3 consecutive pings is enough to establish that. The first time I got that after starting, I would call that a success and start haproxy. If I didn't get that, I would loop back to pinging three times, not starting haproxy. Implementation is up to you -- I know how to do this with sysvinit or daemontools, but not systemd. -dsr-