Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add boot wait #6

Merged
merged 4 commits into from
Dec 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion daemon/wg-quick-op
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -18,4 +36,4 @@ start_service() {

reload_service() {
procd_send_signal wg-quick-op
}
}