Народ подскажите забуксовал немного пытаюсь добавить ddns провайдера в qnap напрямую в
#!/bin/sh
# ddns_update.sh This shell script takes care of ddns updating
#
# description: ez_ipupdate provide register domain name from special server.
# "Server Type" support list.
# DYNDNS = 0, OBS = 1, DNS = 2, DYNS = 3, QDNS = 4, NOIP = 5, SELFHOST = 9, ORAY = 10
# only _viostor_ IPCAM = 6 , NWCAM = 7
# not _viostor_ , TZO = 6
/bin/echo -n "Starting ddns update: "
/bin/rm /tmp/ddns.result -f
DDNS_TMP_FILE="/var/ddns_tmp.conf"
check_ddns_temp_file()
{
if [ ! -f ${DDNS_TMP_FILE} ] || [ $1 -ne 0 ]; then
/bin/echo "${DDNS_TMP_FILE} is not exist"
/bin/echo "[DDNS]" > ${DDNS_TMP_FILE}
/bin/echo "Support = "`/sbin/getcfg "DDNS" "Support" -u -d "TRUE"` >> ${DDNS_TMP_FILE}
/bin/echo "Enable = "`/sbin/getcfg "DDNS" "Enable" -u -d "FALSE"` >> ${DDNS_TMP_FILE}
/bin/echo "Server Type = "`/sbin/getcfg "DDNS" "Server Type" -u -d "0"` >> ${DDNS_TMP_FILE}
/bin/echo "Config File = "`/sbin/getcfg "DDNS" "Config File" -d "/etc/ddns_update.conf"` >> ${DDNS_TMP_FILE}
/bin/echo "Check External IP = "`/sbin/getcfg "DDNS" "Check External IP" -d "0"` >> ${DDNS_TMP_FILE}
/bin/echo "User Name = "`/sbin/getcfg "DDNS" "User Name" -d ""` >> ${DDNS_TMP_FILE}
_epass_tmp=`/sbin/getcfg "DDNS" "ePassword" -d ""`
if [ -z $_epass_tmp ]; then
_pass_tmp=`/sbin/getcfg "DDNS" "Password" -d ""`
if [ -z $_pass_tmp ]; then
/bin/echo "ePassword = " >> ${DDNS_TMP_FILE}
else
_epass_tmp=`/sbin/get_encstr ${_pass_tmp} e`
/bin/echo "ePassword = "$_epass_tmp >> ${DDNS_TMP_FILE}
fi
else
/bin/echo "ePassword = "$_epass_tmp >> ${DDNS_TMP_FILE}
fi
/bin/echo "Host Name = "`/sbin/getcfg "DDNS" "Host Name" -d ""` >> ${DDNS_TMP_FILE}
/bin/echo "DDNS Type = "`/sbin/getcfg "DDNS" "DDNS Type" -d "0"` >> ${DDNS_TMP_FILE}
fi
}
check_ddns_temp_file 0
[ -f /usr/sbin/noip2c ] || /bin/ln -sf /usr/sbin/noip2 /usr/sbin/noip2c
SERVER_TYPE=`/sbin/getcfg "DDNS" "Server Type" -u -d "0" -f ${DDNS_TMP_FILE}`
if [ `/sbin/getcfg "DDNS" "Support" -u -d "TRUE" -f ${DDNS_TMP_FILE}` = TRUE ]
then
if [ `/sbin/getcfg "DDNS" "Enable" -u -d "FALSE" -f ${DDNS_TMP_FILE}` = FALSE ]
then
/bin/echo "disabled."
exit 0
fi
#Hugo add: for ROD ddns support
if [ -e /var/._viostor_ ]; then
if [ ${SERVER_TYPE} = 7 ]; then
user=`/sbin/getcfg "DDNS" "User Name" -d "" -f ${DDNS_TMP_FILE}`
epass=`/sbin/getcfg "DDNS" "ePassword" -d "" -f ${DDNS_TMP_FILE}`
if [ -z $epass ]; then
pass=`/sbin/getcfg "DDNS" "Password" -d "" -f ${DDNS_TMP_FILE}`
else
pass=`/sbin/get_encstr ${epass} d`
fi
/usr/bin/wget "http://www.nwcam.jp/cgi-bin/dip.cgi?username=$user&password=$pass"
result="$?"
echo $result > /tmp/ddns.result
/bin/rm -fr dip.cgi*
/bin/touch /var/lock/subsys/nwcam
/sbin/setcfg "DDNS" "Update Server Response" ${result} -f ${DDNS_TMP_FILE}
[ -f /sbin/set_ipupatetime ] && /sbin/set_ipupatetime "1"
exit $result
elif [ ${SERVER_TYPE} = 6 ]; then
TERM=vt100
user=`/sbin/getcfg "DDNS" "User Name" -d "" -f ${DDNS_TMP_FILE}`
epass=`/sbin/getcfg "DDNS" "ePassword" -d "" -f ${DDNS_TMP_FILE}`
if [ -z $epass ]; then
pass=`/sbin/getcfg "DDNS" "Password" -d "" -f ${DDNS_TMP_FILE}`
else
pass=`/sbin/get_encstr ${epass} d`
fi
/usr/bin/wget "http://ns1.ipcam.jp/cgi-bin/dip.cgi?username=$user&password=$pass"
result="$?"
echo $result > /tmp/ddns.result
# echo -n "ipcam-ddns-update"
# echo -n "ipcam-ddns-update" >> $ddns_debug
# echo "."
/bin/rm -fr dip.cgi*
/bin/touch /var/lock/subsys/ipcam
/sbin/setcfg "DDNS" "Update Server Response" ${result} -f ${DDNS_TMP_FILE}
[ -f /sbin/set_ipupatetime ] && /sbin/set_ipupatetime "1"
exit $result
fi
fi
#End
if [ ${SERVER_TYPE} = 9 ]; then
check_ddns_temp_file 1
/etc/init.d/selfhost-updater.sh update
result=$?
elif [ ${SERVER_TYPE} = 10 ]
then
check_ddns_temp_file 1
/etc/init.d/oray-updater.sh update
result=$?
elif [ ${SERVER_TYPE} != 5 ]
then
/usr/sbin/create_ddns_conf > /dev/null
result=$?
if [ $result -ne 0 ]
then
/bin/echo "ERROR."
exit 1
fi
config_file=`/sbin/getcfg "DDNS" "Config File" -d "/etc/ddns_update.conf" -f ${DDNS_TMP_FILE}`
/usr/sbin/ez-ipupdate -c $config_file 2>/dev/null
result=$?
else
if [ ! -f /etc/config/no-ip2.conf ]; then
username=`/sbin/getcfg "DDNS" "User Name" -d "" -f ${DDNS_TMP_FILE}`
epassword=`/sbin/getcfg "DDNS" "ePassword" -d "" -f ${DDNS_TMP_FILE}`
if [ -z $epassword ]; then
password=`/sbin/getcfg "DDNS" "Password" -d "" -f ${DDNS_TMP_FILE}`
else
password=`/sbin/get_encstr ${epassword} d`
fi
#echo "${epassword}:${password}" > /tmp/noip_pwd
hostname=`/sbin/getcfg "DDNS" "Host Name" -d "" -f ${DDNS_TMP_FILE}`
externalIP=`/sbin/getcfg "DDNS" "Check External IP" -d "5" -f ${DDNS_TMP_FILE}`
if [ $externalIP = 0 ]; then
externalIP=5
fi
option=""
def_gw=`/sbin/getcfg "Network" "Default GW Device"`
if [ ! -z $def_gw ]; then
option="-I ${def_gw}"
fi
/usr/bin/yes ' ' | /usr/sbin/noip2c -C -u "${username}" -p "${password}" -n "${hostname}" -U "${externalIP}" ${option} 1>/dev/null 2>/dev/null
fi
if [ -f /etc/config/no-ip2.conf ]; then
/sbin/daemon_mgr noip2 start "/usr/sbin/noip2 -d 1>>/tmp/noip2.log 2>&1"
result=0
/bin/echo "DDNS was updated successfully"
else
/sbin/setcfg "DDNS" "Enable" "FALSE"
/sbin/setcfg "DDNS" "Enable" "FALSE" -f ${DDNS_TMP_FILE}
result=1
fi
if [ $result -ne 0 ];then
/bin/echo $result > /tmp/ddns.result
else
/bin/echo "DDNS was updated successfully"
fi
#update record
/sbin/setcfg "DDNS" "Update Server Response" ${result} -f ${DDNS_TMP_FILE}
[ -f /sbin/set_ipupatetime ] && /sbin/set_ipupatetime "1"
/bin/echo -n "noip2"
/bin/echo "."
/bin/touch /var/lock/subsys/noip2
exit $result
fi
if [ $result -ne 0 ]
then
/bin/echo $result > /tmp/ddns.result
# /sbin/write_log "Failed to update DDNS." 2
else
/bin/echo "DDNS was updated successfully"
# /sbin/write_log "DDNS was updated successfully." 4
fi
#update record
/sbin/setcfg "DDNS" "Update Server Response" ${result} -f ${DDNS_TMP_FILE}
[ -f /sbin/set_ipupatetime ] && /sbin/set_ipupatetime "1"
/bin/echo -n "ez-ipupdate"
/bin/echo "."
/bin/touch /var/lock/subsys/ez-ipupdate
exit $result
else
/bin/echo "Un-support"
fi
exit 1
____________________________________________________________________________________
а вот это надо сюда впихнуть кто подскажет кто подкинет умную идею как это правильно сделать ???
#!/bin/sh USERNAME="<my-username>" PASSWORD="<my-password>" HOSTNAME="<my-hostname>" # Should be no need to modify anything beyond this point curl -D - --user $USERNAME:$PASSWORD https://dyndns.strato.com/nic/update?hostname=$HOSTNAME >/dev/null 2>&1 if [ $? -eq 0 ]; then /sbin/ddns_custom_updated 1 else /sbin/ddns_custom_updated 0 fi