#!/bin/bash

DNSMGR="https://msk-dns2.hoztnode.net/manager/dnsmgr"
DNSUSER="_DNSUSER_"
DNSUSERPASS="_DNSUSERPASS_"

PATH_LOG="/tmp/certbot_wildcard.log"

# Deleting record
echo -ne "Deleting record ($CERTBOT_VALIDATION) ... " | tee -a $PATH_LOG
res=$(curl -ks "$DNSMGR?authinfo=$DNSUSER:$DNSUSERPASS&out=text&func=domain.record.delete&plid=$CERTBOT_DOMAIN&elid=_acme-challenge.$CERTBOT_DOMAIN.%20TXT%20%20$CERTBOT_VALIDATION&sok=ok")
if [[ $? -eq 0 ]]; then
    echo "OK" | tee -a $PATH_LOG
else
    echo "FALSE ($(echo "$res"))" | tee -a $PATH_LOG
    exit
fi
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"

