Skip to content

Commit

Permalink
fix(flashstart): fixed pinging issues (#956)
Browse files Browse the repository at this point in the history
Also added logging in case curl fails

#955
  • Loading branch information
Tbaile authored Dec 5, 2024
1 parent 7ef1d29 commit 225c40b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/ns-flashstart/files/flashstart-apply
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if [ "$enabled" = "1" ]; then
/etc/init.d/dnsdist restart
fi
/usr/share/ns-flashstart/flashstart-auth
crontab -l | grep -q '/usr/share/ns-flashstart/flashstart-auth' || echo '*/30 * * * * sleep $$(( RANDOM % 60 )); /usr/share/ns-flashstart/flashstart-auth' >> /etc/crontabs/root
crontab -l | grep -q '/usr/share/ns-flashstart/flashstart-auth' || echo '*/30 * * * * sleep $(( RANDOM % 60 )); /usr/share/ns-flashstart/flashstart-auth' >> /etc/crontabs/root
else
crontab -l | grep -v '/usr/share/ns-flashstart/flashstart-auth' | sort | uniq | crontab -
rm -f "$conf"
Expand Down
8 changes: 6 additions & 2 deletions packages/ns-flashstart/files/flashstart-auth
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from euci import EUci
from nethsec import utils
import subprocess
import sys
import syslog

u = EUci()

Expand All @@ -27,6 +29,8 @@ for wan in utils.get_all_wan_devices(u):
else:
id = user
url = f"https://ddns.flashstart.com/nic/update?hostname=&myip=&wildcard=NOCHG&username={id}&password={password}"
cmd = ["curl", "-s", "-o", "/dev/null", "--interface", wan, url]
subprocess.run(cmd)
cmd = ["curl", "-s", "--connect-timeout", "10", "--interface", wan, url]
res = subprocess.run(cmd, capture_output=True, text=True)
if res.returncode != 0:
syslog.syslog(syslog.LOG_ERR, f'Failed to update IP for WAN {wan} -> {id} with error: {res.stdout}')
counter = counter + 1

0 comments on commit 225c40b

Please sign in to comment.