1#!/bin/sh 2 3source_input_data=$@ 4# ***** for duckdns service ****** 5#HOST=`echo "$source_input_data"|awk -F " " '{print $1}'` 6#TOKEN=`echo "$source_input_data"|awk -F " " '{print $2}'` 7# ******************************** 8 9# ***** for google ddns service ******* 10USER=`echo "$source_input_data"|awk -F " " '{print $1}'` 11PASSWD=`echo "$source_input_data"|awk -F " " '{print $2}'` 12HOST=`echo "$source_input_data"|awk -F " " '{print $3}'` 13# ************************************* 14 15# ***** for google ddns service ******* 16result=`curl -k "https://$USER:$PASSWD@domains.google.com/nic/update?hostname=$HOST"` 17#curl -k "https://www.duckdns.org/update?domains=$HOST&token=$TOKEN&ip=" >/dev/null 2>&1 18# ************************************* 19 20# ***** for duckdns service ****** 21#result=`curl -k "https://www.duckdns.org/update?domains=$HOST&token=$TOKEN&ip="` 22#curl -k "https://www.duckdns.org/update?domains=brucechin.duckdns.org&token=886cd7c1-7ba2-43ee-90e0-dac4cb914ac8&ip=" >/dev/null 2>&1 23# ******************************** 24 25case $result in 26 good*|nochg*) 27 nvram set ddns_return_code=200 28 nvram set ddns_return_code_chk=200 29 `ddns_updated` 30 rm -rf /tmp/etc/ddns_result 31 echo "user : $USER host : $HOST passwd : $PASSWD">>/tmp/etc/ddns_result 32 #echo "host : $HOST token : $TOKEN">>/tmp/etc/ddns_result 33 echo "result : $result">>/tmp/etc/ddns_result 34 echo "ddns result : OK">/tmp/etc/ddns_result 35 ;; 36 37 OK) 38 nvram set ddns_return_code=200 39 nvram set ddns_return_code_chk=200 40 `ddns_updated` 41 rm -rf /tmp/etc/ddns_result 42 #echo "host : $HOST token : $TOKEN">>/tmp/etc/ddns_result 43 echo "user : $USER host : $HOST passwd : $PASSWD">>/tmp/etc/ddns_result 44 echo "result : $result">>/tmp/etc/ddns_result 45 echo "ddns result : OK">/tmp/etc/ddns_result 46 ;; 47 48 abuse) 49 nvram set ddns_return_code=200 50 nvram set ddns_return_code_chk=200 51 `ddns_updated` 52 rm -rf /tmp/etc/ddns_result 53 #echo "host : $HOST token : $TOKEN">>/tmp/etc/ddns_result 54 echo "user : $USER host : $HOST passwd : $PASSWD">>/tmp/etc/ddns_result 55 echo "result : $result">>/tmp/etc/ddns_result 56 echo "ddns result : OK">/tmp/etc/ddns_result 57 ;; 58 59 *) 60 nvram set ddns_return_code=401 61 nvram set ddns_return_code_chk=401 62 rm -rf /tmp/etc/ddns_result 63 #echo "host : $HOST token : $TOKEN">>/tmp/etc/ddns_result 64 echo "user : $USER host : $HOST passwd : $PASSWD">>/tmp/etc/ddns_result 65 echo "result : $result">>/tmp/etc/ddns_result 66 echo "ddns result : NG">>/tmp/etc/ddns_result 67 ;; 68esac 69