Skip to content

Instantly share code, notes, and snippets.

View JRDavisUF's full-sized avatar

Justin R. Davis JRDavisUF

  • University of Florida
  • Gainesville, Florida
View GitHub Profile
@ajorg
ajorg / ad-nsupdate.sh
Last active February 20, 2024 18:24
Update Active Directory DNS host records using machine / host / computer credentials and nsupdate
#!/bin/bash -e
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
fqdn="$(hostname -f)"
address="$(/sbin/ip addr show dev eth1 | awk -F'( +|/)' '/inet / {print $3}')"
if [[ "${address}" == "$(dig +short "${fqdn}")" && "${fqdn}." == "$(dig +short -x "${address}")" ]]
then
exit 0
fi
TTL=21600 # 6 hours