diff --git a/daemon/wg-quick-op b/daemon/wg-quick-op index beb09da..6a0da63 100644 --- a/daemon/wg-quick-op +++ b/daemon/wg-quick-op @@ -6,6 +6,24 @@ STOP=15 WG_QUICK_OP_CONF="/etc/wg-quick-op.yaml" +MAX_WAIT=60 +INTERVAL=1 + +boot() { + waited_time=0 + while [ $waited_time -lt $MAX_WAIT ]; do + if nslookup localhost >/dev/null 2>&1 || dig +short localhost >/dev/null 2>&1; then + start + return + else + sleep $INTERVAL + waited_time=$((waited_time + $INTERVAL)) + fi + done + + echo "localhost is not resolved. Not starting myservice..." +} + start_service() { mkdir -p /var/run procd_open_instance @@ -18,4 +36,4 @@ start_service() { reload_service() { procd_send_signal wg-quick-op -} \ No newline at end of file +}