Skip to content

Instantly share code, notes, and snippets.

@sdellenb
Created Jan 20, 2021
Embed
What would you like to do?
Archive Netcup DNS zones to git
#!/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