delDNSName 496 B

123456789101112131415161718
  1. #!/bin/bash
  2. SUB_DOMAIN="${1:?Need customer subdomain code}"
  3. ZONE="linuxforward.com"
  4. # get subdomain record id
  5. record_id=$( ./ovhcli get "domain/zone/${ZONE}/record?fieldType=A&subDomain=${SUB_DOMAIN}" | jq -r '.[]' )
  6. if [ -n "${record_id}" ]; then
  7. ./ovhcli delete "domain/zone/${ZONE}/record/${record_id}" | jq -r 'select(. != null)'
  8. sleep 2
  9. ./ovhcli post "domain/zone/${ZONE}/refresh" | jq -r 'select(. != null)'
  10. else
  11. echo "Could not find any RecordID for ${SUB_DOMAIN}"
  12. fi
  13. exit $?