I have a headless media server using mpd running on gentoo. Mpd is configured to start at boot (and I don't have the rc scripts running in parallel either), but unfortunately mpd won't start if it can't bind to an interface. I've tried giving my wireless lan a static ip address but occasionally mpd won't start because the wlan card has not associated with the access point (I'm using wpa_supplicant).
Now when ssh starts it's quite happy to wait for the interface to come up. But even with a little digging I'm unable to find out quite how it does that.
My horrible hack would be for the mpd script just to wait for "sufficient" time for the wlan card to associate, but that won't work in all circumstances.
Anyone got any pointers?
NB: Related questions that don't answer my question (but might be useful to others are here):
run-a-script-when-connected-to-a-wireless-network-in-linux, and linux-how-to-start-skype-or-other-program-only-when-im-online