Re: Script - DDNSupdater.sh
Verfasst: Mo 2. Apr 2012, 19:50
Namd!
Wie sind die Einstellungen in der Vorkonfiguration für no-ip.com?
Gruß darkjudge
Wie sind die Einstellungen in der Vorkonfiguration für no-ip.com?
Gruß darkjudge
Code: Alles auswählen
URL="http://dynupdate.no-ip.com/dns?username=%USER%&password=%PASS%&hostname=$DDNSHOST"
Code: Alles auswählen
URL=${URL//%USER%/`proc_url_encode "${USERNAME[$index]}"`}
URL=${URL//%PASS%/`proc_url_encode "${PASSWORD[$index]}"`}
URL=${URL//%HOST%/${DDNSHOST[$index]}}
Code: Alles auswählen
proc_url_encode() {
out=${1//%/%25}; out=${out//\{/%7B}; out=${out//\}/%7D}; out=${out//|/%7C};
out=${out//\\/%5C}; out=${out//^/%5E}; out=${out//~/%7E}; out=${out//[/%5B};
out=${out//]/%5D}; out=${out//\`/%60}; out=${out//#/%23}; out=${out//>/%3E};
out=${out//\$/%24}; out=${out//&/%26}; out=${out//+/%2B}; out=${out//,/%2C};
out=${out//\//%2F}; out=${out//:/%3A}; out=${out//;/%3B}; out=${out//=/%3B};
out=${out//\?/%3F}; out=${out// /%20}; out=${out//</%3C};
echo $out
}
Code: Alles auswählen
function proc_url_encode() {
out=${1//%/%25}; out=${out//\{/%7B}; out=${out//\}/%7D}; out=${out//|/%7C};
out=${out//\\/%5C}; out=${out//^/%5E}; out=${out//~/%7E}; out=${out//[/%5B};
out=${out//]/%5D}; out=${out//\`/%60}; out=${out//#/%23}; out=${out//>/%3E};
out=${out//\$/%24}; out=${out//&/%26}; out=${out//+/%2B}; out=${out//,/%2C};
out=${out//\//%2F}; out=${out//:/%3A}; out=${out//;/%3B}; out=${out//=/%3B};
out=${out//\?/%3F}; out=${out// /%20}; out=${out//</%3C};
out=${out//\!/%21}; out=${out//\"/%22}; out=${out//\@/%40}; out=${out//\'/%27};
out=${out//\(/%28}; out=${out//\)/%29}; out=${out//\*/%2A}; out=${out//\-/%2D};
out=${out//\_/%5F}; out=${out//\./%2E}; out=${out//\€/%80};
echo $out
}
Code: Alles auswählen
function LOG_msg() {
message=$1
if [ $LOG = "1" ]; then
_DT=$(date +"%d.%m.%Y %H:%M:%S")
echo "$_DT: $message" >> $LOGFILE
fi
}
Code: Alles auswählen
echo "DDNSHOST: ${DDNSHOST[$index]} - DYNIP: $DYNIP - CURRENTIP: $CURRENTIP - answer: $answer"
LOG_msg "DDNSHOST: ${DDNSHOST[$index]} - DYNIP: $DYNIP - CURRENTIP: $CURRENTIP - answer: $answer"
Code: Alles auswählen
+ USERNAME["1"]=***
+ PASSWORD["1"]=***
+ DDNSHOST["1"]=***.dyndns.org
+ URL["1"]='http://%USER%:%PASS%@members.dyndns.org/nic/update?hostname=%HOST%'
+ EVERY=90
+ LOG=1
+ EMAIL=no
++ hostname
+ EMAILFROM=oscam@fqdn.net
+ EMAILTO=admin@fqdn.net
+ EMAILSERVER=mail.fqdn.net
+ EMAILUSER=
+ EMAILPASS=
+ Osrcn=DDNSupdater.sh
++ basename /var/emu/script/DDNSupdater.sh
+ srcn=DDNSupdater.sh
+ srcv=2.01
+ srccfg=config.DDNSupdater.sh
+ LOGFILE=/var/log/ipc/log.DDNSupdater.sh
+ CHKFILE=/tmp/.DDNSupdater.sh
+ PiDFILE=/tmp/.pid.DDNSupdater.sh
+ OnlinePing=google.de
+ ProfileSwitchSleep=2
+ IPCcfgdir=/var/emu/conf
+ IPCfunctions=/var/emu/script/functions.sh
+ IPCddnssrc=/var/emu/script/DDNSupdater.sh
+ IPCddnslinkname=ddns
+ C='\033['
+ Ca='\033[0;33m'
+ Cb='\033[1;33m'
+ Cn='\033[0m'
+ ROT='\033[1;31m'
+ GRUEN='\033[1;32m'
+ BOLD='\033[1;37m'
+ Bo='\033[1m'
+ Bc='\033[21m'
+ Ro='\033[3m'
+ Rc='\033[23m'
+ Uo='\033[4m'
+ Uc='\033[24m'
+ Blo='\033[5m'
+ Blc='\033[25m'
+ Io='\033[7m'
+ Ic='\033[27m'
+ '[' -f /var/emu/script/functions.sh -a '!' -f /var/emu/script/DDNSupdater.sh ']'
+ '[' -d /var/emu/conf -a -f /var/emu/conf/config.DDNSupdater.sh ']'
+ '[' '!' -d /var/emu/conf -a -f config.DDNSupdater.sh ']'
+ '[' -f /var/emu/script/functions.sh -a -f /var/emu/script/DDNSupdater.sh ']'
+ linkname=ddns
+ case "$1" in
+ check_profils 'do_update abuse_check'
+ ACTION='do_update abuse_check'
+ for index in '${!DDNSHOST[*]}'
+ eRROR=
+ get_IPs 1
+ index=1
++ cut -d ' ' -f3
++ sed -e 's/(//g' -e 's/)//g'
++ sed -e 's/\://g'
++ sed -n 1p
++ ping -c 1 ***.dyndns.org
+ DYNIP=***
+ '[' -z *** ']'
++ wget -q -O - http://myip.dnsomatic.com/
+ CURRENTIP=88.153.152.x
+ '[' -z *** -o *** = ' *' -o *** = '*1.0 *' ']'
+ '[' -z ***-o *** = ' *' -o *** = '*1.0 *' ']'
+ '[' -z ***-o *** = ' *' -o *** = '*1.0 *' ']'
+ '[' -z *** -o *** = ' *' -o *** = '*1.0 *' ']'
+ '[' -z *** ']'
+ '[' -z '' ']'
+ '[' *** '!=' *** ']'
+ '[' '!' -z '' ']'
+ sleep 2
+ exit 0
Code: Alles auswählen
#URL["1"]="http://%USER%:%PASS%@members.dyndns.org/nic/update?hostname=%HOST%"
URL["1"]="http://%***%:%***%@members.dyndns.org/nic/update?hostname=%***.dyndns.org%"
Code: Alles auswählen
bash -x /var/emu/script/DDNSupdater.sh now
+ USERNAME["1"]=***
+ PASSWORD["1"]=***
+ DDNSHOST["1"]=***.dyndns.org
+ URL["1"]='http://%***%:%***%@members.dyndns.org/nic/update?hostname=%***.dyndns.org%'
+ EVERY=90
+ LOG=1
+ EMAIL=no
++ hostname
+ EMAILFROM=oscam@fqdn.net
+ EMAILTO=admin@fqdn.net
+ EMAILSERVER=mail.fqdn.net
+ EMAILUSER=
+ EMAILPASS=
+ Osrcn=DDNSupdater.sh
++ basename /var/emu/script/DDNSupdater.sh
+ srcn=DDNSupdater.sh
+ srcv=2.01
+ srccfg=config.DDNSupdater.sh
+ LOGFILE=/var/log/ipc/log.DDNSupdater.sh
+ CHKFILE=/tmp/.DDNSupdater.sh
+ PiDFILE=/tmp/.pid.DDNSupdater.sh
+ OnlinePing=google.de
+ ProfileSwitchSleep=2
+ IPCcfgdir=/var/emu/conf
+ IPCfunctions=/var/emu/script/functions.sh
+ IPCddnssrc=/var/emu/script/DDNSupdater.sh
+ IPCddnslinkname=ddns
+ C='\033['
+ Ca='\033[0;33m'
+ Cb='\033[1;33m'
+ Cn='\033[0m'
+ ROT='\033[1;31m'
+ GRUEN='\033[1;32m'
+ BOLD='\033[1;37m'
+ Bo='\033[1m'
+ Bc='\033[21m'
+ Ro='\033[3m'
+ Rc='\033[23m'
+ Uo='\033[4m'
+ Uc='\033[24m'
+ Blo='\033[5m'
+ Blc='\033[25m'
+ Io='\033[7m'
+ Ic='\033[27m'
+ '[' -f /var/emu/script/functions.sh -a '!' -f /var/emu/script/DDNSupdater.sh ']'
+ '[' -d /var/emu/conf -a -f /var/emu/conf/config.DDNSupdater.sh ']'
+ '[' '!' -d /var/emu/conf -a -f config.DDNSupdater.sh ']'
+ '[' -f /var/emu/script/functions.sh -a -f /var/emu/script/DDNSupdater.sh ']'
+ linkname=ddns
+ case "$1" in
+ check_profils 'do_update abuse_check'
+ ACTION='do_update abuse_check'
+ for index in '${!DDNSHOST[*]}'
+ eRROR=
+ get_IPs 1
+ index=1
++ sed -e 's/(//g' -e 's/)//g'
++ cut -d ' ' -f3
++ sed -n 1p
++ sed -e 's/\://g'
++ ping -c 1 ***.dyndns.org
+ DYNIP=***
+ '[' -z *** ']'
++ wget -q -O - http://myip.dnsomatic.com/
+ CURRENTIP=***
+ '[' -z *** -o *** = ' *' -o *** = '*1.0 *' ']'
+ '[' -z ***-o *** = ' *' -o *** = '*1.0 *' ']'
+ '[' -z ***-o *** = ' *' -o *** = '*1.0 *' ']'
+ '[' -z *** -o *** = ' *' -o *** = '*1.0 *' ']'
+ '[' -z *** ']'
+ '[' -z '' ']'
+ '[' *** '!=' *** ']'
+ '[' '!' -z '' ']'
+ sleep 2
+ exit 0