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 "Configuration file is \"$conf\","
echo "using \"$conf_d\" as configuration directory."
echo
- exit 1
+ exit 2
}
CleanUp() {
# Search configuration file (last one is used as default!)
for conf in \
"/usr/local/etc/backup-script.conf" \
- "${conf_d}/backup-script.conf" \
"/etc/backup-script.conf" \
+ "${conf_d}/backup-script.conf" \
+ "/usr/local/etc/backup-script.conf" \
; do
[ -r "$conf" ] && break
done
for s in "$@"; do
if [ ! -r "${conf_d}/$s" ]; then
echo "$NAME: Can' read \"${conf_d}/$s\"!"
- exit 1
+ exit 3
fi
sys="$sys ${conf_d}/$s"
done
echo
echo -n "Aborted: "; date
echo
- exit 3
+ exit 4
fi
touch "$PIDFILE" 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error: pre-exec command failed!"; echo
CleanUp
echo "Aborting backup."; echo
- exit 2
+ exit 5
fi
sleep 2
echo
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
if [ $ret -eq 20 ]; then
echo "Backup of \"$system\" interrupted. Aborting ..."
- CleanUp
- exit 1
+ GotSignal
fi
echo -n "End date: "; date
if [ $count_started -ne $count_ok ]; then
echo "-----> THERE HAVE BEEN ERRORS! <-----"
echo
+ exit 6
fi
# -eof-