diff --git a/src/freedombone-installer b/src/freedombone-installer index 3166768313fbc82e03bce0d508e0e8776d8ce067..ecc6186f613ec225ebe28ea0316e438adc454938 100755 --- a/src/freedombone-installer +++ b/src/freedombone-installer @@ -140,6 +140,7 @@ ICECAST_JINGLES=/jingles liquidsoap_script=/etc/liquidsoapuser/radio.liq webadmin_ipv4_address= +webadmin_monitor_ip_ctr=0 function get_external_ipv4_address { curl -s ipinfo.io/ip @@ -2598,13 +2599,17 @@ function update_dynamic_dns { } function webadmin_monitor_ip_changes { - curr_ipv4=$(get_external_ipv4_address) - if [[ "$curr_ipv4" != "$webadmin_ipv4_address" ]]; then - if [ "$webadmin_ipv4_address" ]; then - /usr/local/bin/${PROJECT_NAME}-notification -s "[${PROJECT_NAME}] Dynamic DNS" -m "IP address changed from $webadmin_ipv4_address to $curr_ipv4" + webadmin_monitor_ip_ctr=$((webadmin_monitor_ip_ctr+1)) + if [ $webadmin_monitor_ip_ctr -gt 100 ]; then + curr_ipv4=$(get_external_ipv4_address) + if [[ "$curr_ipv4" != "$webadmin_ipv4_address" ]]; then + if [ "$webadmin_ipv4_address" ]; then + /usr/local/bin/${PROJECT_NAME}-notification -s "[${PROJECT_NAME}] Dynamic DNS" -m "IP address changed from $webadmin_ipv4_address to $curr_ipv4" + fi + webadmin_ipv4_address="$curr_ipv4" + update_dynamic_dns fi - webadmin_ipv4_address="$curr_ipv4" - update_dynamic_dns + webadmin_monitor_ip_ctr=0 fi }