Skip to content

Commit

Permalink
Merge pull request #6 from ljcbaby/master
Browse files Browse the repository at this point in the history
  • Loading branch information
BaiMeow authored Dec 14, 2023
2 parents e499a05 + c046cd9 commit 7f462e1
Showing 1 changed file with 19 additions and 1 deletion.
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
}
}

0 comments on commit 7f462e1

Please sign in to comment.