-
Notifications
You must be signed in to change notification settings - Fork 53
/
noip.sh
36 lines (26 loc) · 923 Bytes
/
noip.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
GENERATED_CONFIG_FILE=/config/no-ip2.generated.conf
#-----------------------------------------------------------------------------------------------------------------------
function ts {
echo [`date '+%b %d %X'`]
}
#-----------------------------------------------------------------------------------------------------------------------
while true
do
echo "$(ts) Launching the noip2 daemon"
/files/noip2-x86_64 -c "$GENERATED_CONFIG_FILE"
# Give it a few seconds to do the first update. This helps avoid questions about "Last IP Address set 0.0.0.0"
sleep 5
while true
do
output=$(/files/noip2-x86_64 -c "$GENERATED_CONFIG_FILE" -S 2>&1)
echo "$(ts) Current status"
echo "$output"
if [[ "$output" != *"started as"* ]]; then
echo "$(ts) ERROR: noip2 daemon has stopped running. Restarting it in 60 seconds."
sleep 60
break
fi
sleep 60
done
done