destinations=""
# Default settings, can be overwritten in backup-script.conf:
-conf_d="/etc/backup-script.d"
+[ -d "/usr/local/etc/backup-script.d" ] \
+ && conf_d="/usr/local/etc/backup-script.d" \
+ || conf_d="/etc/backup-script.d"
pre_exec=""
post_exec=""
default_source_root="/"
-default_target=""
+default_target="/var/backups"
default_user="root"
default_ssh_args_add=""
default_rsync_args_add=""
echo
echo "When no <system> is given, all defined systems are used."
echo
+ echo "Configuration file is \"$conf\","
+ echo "using \"$conf_d\" as configuration directory."
+ echo
exit 1
}
return 0
}
+# Search configuration file (last one is used as default!)
+for conf in \
+ "/usr/local/etc/backup-script.conf" \
+ "/etc/backup-script.conf" \
+ "${conf_d}/backup-script.conf" \
+ "/usr/local/etc/backup-script.conf" \
+; do
+ [ -r "$conf" ] && break
+done
+
while [ $# -gt 0 ]; do
case "$1" in
"-n"|"--dry-run")
echo -n "Started: "; date
-for conf in "/etc/backup-script.conf" "${conf_d}/backup-script.conf"; do
- if [ -r "$conf" ]; then
- echo "Reading configuration: \"$conf\" ..."
- source "$conf"
- fi
-done
+# Read in configuration file
+if [ -r "$conf" ]; then
+ echo "Reading configuration: \"$conf\" ..."
+ source "$conf"
+else
+ echo "No configuration file found, using defaults."
+fi
echo
if [ $# -ge 1 ]; then
post_exec="$post_exec_saved"
# Validate configuration
- [ "$system" = "localhost" -o "$system" = "127.0.0.1" ] && local=1
+ if [ "$system" = "localhost" -o "$system" = "127.0.0.1" ]; then
+ # Local system
+ local=1
+ compress=0
+ fi
# Make sure "source" ends with a slash ("/")
case "$source" in