#!/bin/shPUBLIC_IP=$(curl -s http://ipecho.net/plain; echo)echo $PUBLIC_IP
#!/bin/sh# No-IP uses emails as passwords, so make sure that you encode the @ as %40USERNAME=--account name--PASSWORD=--my password--HOST=--my host name--LOGFILE=/var/log/noip.logSTOREDIPFILE=/var/run/current_ipUSERAGENT="Simple Bash No-IP Updater/0.4 antoniocs@gmail.com"if [ ! -e $STOREDIPFILE ]; then touch $STOREDIPFILEfiNEWIP=$(curl http://icanhazip.com/)STOREDIP=$(cat $STOREDIPFILE)if [ "$NEWIP" != "$STOREDIP" ]; then RESULT=$(curl -o "$LOGFILE" -s --user-agent "$USERAGENT" "https://$USERNAME:$PASSWORD@dynupdate.no-ip.com/nic/update?hostname=$HOST&myip=$NEWIP") LOGLINE="[$(date +"%Y-%m-%d %H:%M:%S")] $RESULT" echo $NEWIP > $STOREDIPFILEelse LOGLINE="[$(date +"%Y-%m-%d %H:%M:%S")] No IP change"fiecho $LOGLINE >> $LOGFILEexit 0