sync.sh: RSYNCOPTS is now an array
This commit is contained in:
@@ -29,10 +29,12 @@ NDAYS=7
|
|||||||
|
|
||||||
# FILTER can be used to filter directories to include/exclude. See rsync(1) for
|
# FILTER can be used to filter directories to include/exclude. See rsync(1) for
|
||||||
# details.
|
# details.
|
||||||
FILTER=--filter="dir-merge .rsync-filter-br"
|
FILTER="--filter=dir-merge .rsync-filter-br"
|
||||||
|
|
||||||
# other rsync options
|
# other rsync options. It must be an array. For example, the following line
|
||||||
RSYNCOPTS=""
|
# is equivalent to the FILTER line above:
|
||||||
|
# RSYNCOPTS=( "--filter=dir-merge .rsync-filter-br" )
|
||||||
|
RSYNCOPTS=()
|
||||||
|
|
||||||
# functions run just before and after the rsync. Could be useful to create
|
# functions run just before and after the rsync. Could be useful to create
|
||||||
# database dumps, etc...
|
# database dumps, etc...
|
||||||
|
11
bash/sync.sh
11
bash/sync.sh
@@ -150,7 +150,7 @@ NYEARS=3 # keep # years (int)
|
|||||||
NMONTHS=12 # keep # months (int)
|
NMONTHS=12 # keep # months (int)
|
||||||
NWEEKS=4 # keep # weeks (int)
|
NWEEKS=4 # keep # weeks (int)
|
||||||
NDAYS=7 # keep # days (int)
|
NDAYS=7 # keep # days (int)
|
||||||
RSYNCOPTS="" # other rsync options
|
declare -a RSYNCOPTS=() # other rsync options
|
||||||
SOURCEDIR="." # source dir
|
SOURCEDIR="." # source dir
|
||||||
DESTDIR="." # destination dir
|
DESTDIR="." # destination dir
|
||||||
MODIFYWINDOW=1 # accuracy for mod time comparison
|
MODIFYWINDOW=1 # accuracy for mod time comparison
|
||||||
@@ -213,7 +213,7 @@ shift $((OPTIND - 1))
|
|||||||
CONFIG="$1"
|
CONFIG="$1"
|
||||||
if [[ ! -r "$CONFIG" ]]; then
|
if [[ ! -r "$CONFIG" ]]; then
|
||||||
printf "%s: Cannot open $CONFIG file. Exiting." "$CMDNAME"
|
printf "%s: Cannot open $CONFIG file. Exiting." "$CMDNAME"
|
||||||
usage
|
exit 1
|
||||||
fi
|
fi
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source "$CONFIG"
|
source "$CONFIG"
|
||||||
@@ -288,7 +288,6 @@ exit_handler() {
|
|||||||
exec 1<&3 3>&- 0<"$TMPFILE"
|
exec 1<&3 3>&- 0<"$TMPFILE"
|
||||||
rm -f "$TMPFILE"
|
rm -f "$TMPFILE"
|
||||||
else
|
else
|
||||||
echo 222
|
|
||||||
exec 0<<<"" # force empty input for the following
|
exec 0<<<"" # force empty input for the following
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -401,6 +400,9 @@ log "Config : ${CONFIG}"
|
|||||||
log "Src dir: ${SOURCEDIR}"
|
log "Src dir: ${SOURCEDIR}"
|
||||||
log "Dst dir: ${SERVER}:${DESTDIR}"
|
log "Dst dir: ${SERVER}:${DESTDIR}"
|
||||||
log "Actions: ${TODO[*]}"
|
log "Actions: ${TODO[*]}"
|
||||||
|
log "Filter: $FILTER"
|
||||||
|
log "Rsync additional options (${#RSYNCOPTS[@]}): ${#RSYNCOPTS[@]}"
|
||||||
|
|
||||||
log -n "Mail recipient: "
|
log -n "Mail recipient: "
|
||||||
# shellcheck disable=SC2015
|
# shellcheck disable=SC2015
|
||||||
[[ -n "$MAILTO" ]] && log "$MAILTO" || log "<unset>"
|
[[ -n "$MAILTO" ]] && log "$MAILTO" || log "<unset>"
|
||||||
@@ -529,11 +531,10 @@ do
|
|||||||
# - "vanished file" (exit code 24).
|
# - "vanished file" (exit code 24).
|
||||||
# - others?
|
# - others?
|
||||||
status=0
|
status=0
|
||||||
# shellcheck disable=SC2086
|
|
||||||
echorun rsync \
|
echorun rsync \
|
||||||
-aHixv \
|
-aHixv \
|
||||||
"${FILTER}" \
|
"${FILTER}" \
|
||||||
${RSYNCOPTS} \
|
"${RSYNCOPTS[@]}" \
|
||||||
${COMPRESS} \
|
${COMPRESS} \
|
||||||
${NUMID} \
|
${NUMID} \
|
||||||
--delete \
|
--delete \
|
||||||
|
Reference in New Issue
Block a user