-
-
Save sdellenb/299400b7aadc17c2a49d502ecc1f5d7d to your computer and use it in GitHub Desktop.
Archive Netcup DNS zones to git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -Eeo pipefail | |
if [[ "$#" -ne 1 || ! ( "$1" == *ncdapi.sh) ]] | |
then | |
echo "Usage: $0 /path/to/ncdapi.sh" | |
exit 1 | |
fi | |
declare -a zones=("example.com" "example.de" "example.org") | |
for zone in "${zones[@]}" | |
do | |
printf 'Backing up zone %s...\n' "${zone}" | |
bash "$1" -b "${zone}" | |
mv -v backup-${zone}-*.txt "${zone}.json" | |
git add "${zone}.json" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment