#!/bin/sh

# Check if DYN_DNS_URL is set
if [ -z "$DYN_DNS_URL" ]; then
  exit 1
fi

# Check if INTERVAL_TIME is set
if [ -z "$INTERVAL_TIME" ]; then
  INTERVAL_TIME=300
fi

# Infinite loop
while :
do
  curl $CURL_PARAM $DYN_DNS_URL
  sleep $INTERVAL_TIME
done

#!/bin/sh

# Check if DYN_DNS_URL is set
if [ -z "$DYN_DNS_URL" ]; then
  echo "Variable DYN_DNS_URL has to be set!"
  exit 1
fi

# Check if INTERVAL_TIME is set
if [ -z "$INTERVAL_TIME" ]; then
  echo "Variable INTERVAL_TIME is set to 300"
  INTERVAL_TIME=300
fi

old_ip=""
# Infinite loop
while true; do
  current_ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
  if ! [ "$current_ip" = "$old_ip" ]; then
    curl -s $CURL_PARAM $DYN_DNS_URL > /dev/null
    old_ip="$current_ip"
    echo -n "DynDNS is updated to $current_ip on "; date
  fi
  sleep $INTERVAL_TIME
done

Add precise output and ip change tracking
Add precise output and ip change tracking