#save the api addr and key to the account conf file.
_saveaccountconf PDNS_Host "$PDNS_Host"
_saveaccountconf PDNS_Port "$PDNS_Port"
_saveaccountconf PDNS_User "$PDNS_User"
_saveaccountconf PDNS_Pass "$PDNS_Pass"
_saveaccountconf PDNS_Database "$PDNS_Database"
if["$PDNS_Ttl" !="$DEFAULT_PDNS_TTL"];then
_saveaccountconf PDNS_Ttl "$PDNS_Ttl"
fi
_domain_id=$(mysql -ss "-h${PDNS_Host}""-P${PDNS_Port}""-u${PDNS_User}""-p${PDNS_Pass}" -e "SELECT id FROM ${PDNS_Database}.domains WHERE name='${root}';")
if[ -z "$_domain_id"];then
return1
@ -202,10 +152,6 @@ rm_record() {
_info "Remove record"
root=$1
full=$2
DEFAULT_PDNS_TTL=60
if ! _exists mysql;then
_err "'mysql not found. It seems that mysql client is not installed.'"
#save the api addr and key to the account conf file.
_saveaccountconf PDNS_Host "$PDNS_Host"
_saveaccountconf PDNS_Port "$PDNS_Port"
_saveaccountconf PDNS_User "$PDNS_User"
_saveaccountconf PDNS_Pass "$PDNS_Pass"
_saveaccountconf PDNS_Database "$PDNS_Database"
if["$PDNS_Ttl" !="$DEFAULT_PDNS_TTL"];then
_saveaccountconf PDNS_Ttl "$PDNS_Ttl"
fi
_pdns_rm=$(mysql -ss "-h${PDNS_Host}""-P${PDNS_Port}""-u${PDNS_User}""-p${PDNS_Pass}" -e "DELETE FROM ${PDNS_Database}.records WHERE name='${full}' AND type='TXT';")
if[ -z "$_pdns_rm"];then
@ -279,70 +180,20 @@ rm_record() {
notify_slaves(){
root=$1
DEFAULT_PDNS_TTL=60
# hack set last_check to null to force update. #
if ! _exists mysql;then
_err "'mysql not found. It seems that mysql client is not installed.'"
#save the api addr and key to the account conf file.
_saveaccountconf PDNS_Host "$PDNS_Host"
_saveaccountconf PDNS_Port "$PDNS_Port"
_saveaccountconf PDNS_User "$PDNS_User"
_saveaccountconf PDNS_Pass "$PDNS_Pass"
_saveaccountconf PDNS_Database "$PDNS_Database"
if["$PDNS_Ttl" !="$DEFAULT_PDNS_TTL"];then
_saveaccountconf PDNS_Ttl "$PDNS_Ttl"
fi
_pdns_notify=$(mysql -ss "-h${PDNS_Host}""-P${PDNS_Port}""-u${PDNS_User}""-p${PDNS_Pass}" -e "UPDATE ${PDNS_Database}.domains SET last_check=NULL WHERE name='${root}';")
if[ -z "$_pdns_notify"];then
@ -359,10 +210,6 @@ notify_slaves() {
_get_root(){
domain=$1
i=1
DEFAULT_PDNS_TTL=60
if ! _exists mysql;then
_err "'mysql not found. It seems that mysql client is not installed.'"