set -e
set -u
-export LC_ALL=C
-export LANG=C
+export LC_ALL="en_US.utf8"
+export LANG="en_US.utf8"
VERBOSE="n"
DEBUG="n"
QUIET='n'
-VERSION="1.0"
+VERSION="1.1"
# console colors:
RED=""
NORMAL=""
HAS_TTY='y'
+HAS_COLORS="n"
BASENAME="$(basename ${0})"
BASE_DIR="$(dirname ${0})"
-declare -a DATABASES=()
+declare -a ZONES=()
#########################################################
# Modify below variables to fit your need ----
GREEN="\033[38;5;46m"
BLUE="\033[38;5;27m"
NORMAL="\033[39m"
+ HAS_COLORS="y"
else
RED=""
YELLOW=""
GREEN=""
BLUE=""
NORMAL=""
+ HAS_COLORS="n"
shift
;;
--nocolor)
GREEN=""
BLUE=""
NORMAL=""
+ HAS_COLORS="n"
shift
;;
-h|--help)
}
+#------------------------------------------------------------------------------
+get_zones() {
+
+ local no_color_option=""
+ if [[ "${HAS_COLORS}" == "n" ]] ; then
+ no_color_option="--color no"
+ fi
+
+ if [[ ! -x ./pdns-list-zones ]] ; then
+ error "Script '${RED}${BASE_DIR}/pdns-list-zones${NORMAL}' not found."
+ exit 5
+ fi
+
+ local zone=
+ for zone in $( ./pdns-list-zones ${no_color_option} --global --quiet | \
+ tail -n +3 | awk '{print $1}' ) ; do
+ ZONES+=( "${zone}" )
+ done
+
+ if [[ "${VERBOSE}" == "y" ]] ; then
+ echo
+ echo "Zones to backup:"
+ for zone in "${ZONES[@]}" ; do
+ echo " * '${zone}'"
+ done
+ echo
+ fi
+
+
+}
+
#------------------------------------------------------------------------------
backup_databases() {
prepare_dirs
info "Starting backup ..."
cleanup_old_backups
- #get_databases
+ get_zones
#backup_databases
empty_line